SQL´æ´¢¹ý³ÌʵÀý
Àý1 ´«ÈëÒ»¸ö²ÎÊý@username,ÅжÏÓû§ÊÇ·ñ´æÔÚ
-------------------------------------------------------------------------------
CREATE PROC IsExistUser
(
@username varchar(20),
@IsExistTheUser varchar(25) OUTPUT--Êä³ö²ÎÊý
)
as
SELECT @IsExistTheUser = count(username)
from users
WHERE username = @username
GO
Àý2 ´æ´¢¹ý³Ì½áºÏÊÂÎñµÄÒ»¸öÀý×Ó£ºÌí¼ÓÓû§£¬Éæ¼°µ½Á½¸ö±í£¬Ò»¸öÓû§×ÊÁÏ±í£¬Ò»¸öÃÜÂë±í£º
Ôö¼ÓÓû§
-------------------------------------------------------------------------------
create procedure AddUser
(
@username varchar(20),--̞
@passwords varchar(18),--ÃÜÂë
@email varchar(100),--ÓÊÏä
@qq varchar(11),--QQºÅÂë
@imageid int--Í·Ïñ
)
as
-- ÉèÖÃNOCOUNTΪON£¬Ê¹²»ÔÙ·µ»Øͳ¼ÆÐÅÏ¢£¨´æ´¢¹ý³ÌÖаüº¬µÄһЩÓï¾ä²¢²»·µ»ØÐí¶àʵ¼ÊµÄÊý¾Ý£¬Ôò¸ÃÉèÖÃÓÉÓÚ´óÁ¿¼õÉÙÁËÍøÂçÁ÷Á¿£¬Òò´Ë¿ÉÏÔÖøÌá¸ßÐÔÄÜ¡££©
SET NOCOUNT ON
DECLARE @CurrentError int
-- ´´½¨ÊÂÎñ, ²åÈëÊý¾Ýµ½2¸ö±í
BEGIN TRANSACTION
-- ´´½¨Óû§ÐÅÏ¢
INSERT INTO users (username, email, qq, imageid)
VALUES (@username, @email, @qq, @imageid)
select @CurrentError = @@Error
IF @CurrentError != 0
BEGIN
GOTO ERROR_HANDLER
END
-- ´´½¨Óû§ÃÜÂë
INSERT INTO Signon (username, [password])
VALUES (@username, @passwords)
select @CurrentError = @@Error
IF @CurrentError != 0
BEGIN
GOTO ERROR_HANDLER
END
-- ½áÊøÊÂÎñ
COMMIT TRANSACTION
-- »Ö¸´NOCOUNTÉèÖÃΪOFF
SET NOCOUNT OFF
-- ·µ»Ø0±íʾ³É¹¦£¬ÆäËûÔòΪʧ°Ü
RETURN 0
-- ´íÎó´¦Àí
ERROR_HANDLER:
ROLLBACK TRANSACTION
SET NOCOUNT OFF
RETURN @CurrentError
GO
Ïà¹ØÎĵµ£º
mysql> create table testdate(
-> id int not null auto_increment primary key,
-> time date);
Query OK, 0 rows affected (0.30 sec)
mysql> insert into testdate(time) values('2010-4-23');
Q ......
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'CLR', 0
GO
-- To update the currently configured value for this feature.
......
×÷Õß: cnd8, ¡¡³ö´¦:ITר¼ÒÍøÂÛ̳,¡¡ÔðÈαà¼: ³Â×Óç÷,¡¡2010-04-21 13:00 ¡¡¡¡ÏÖÔÚÐèÒªÔÚһ̨·þÎñÆ÷(A)ÉϵÄÊý¾Ý¿â(Master)Àï·ÃÎÊÁíÍâһ̨·þÎñÆ÷(B)µÄÁíÍâÁ½¸öÊý¾Ý¿â(NZ ºÍ AU)¡£AU ºÍ NZ ÊÇÍøÕ¾µÄ²¿·ÖʵʱÊý¾Ý£¬Ä¿Ç°Ä³Ò»²½²Ù×÷µÄREPLICATION·½°¸ÊÇ´Ó·þÎñÆ÷Bµ½A£¬AU / NZ µÄ±í½á¹¹Í¬Master Êý¾Ý½á¹¹»ù±¾Ò»Ö¡£¡¡¡¡ÏÖÔÚÐèÒªÔ ......
--ÈÕÆÚת»»²ÎÊý,ÖµµÃÊÕ²Ø
select CONVERT(varchar, getdate(), 120)
2004-09-12 11:06:08
select convert(varchar(10),getdate() ,120)
----------
2009-04-09
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','')
20040912110608
select CONVERT(varchar(12) , get ......
¸ãÁ˺ܾᣡ£ÖÕÓÚ·¢ÏÖÔÀ´ÊÇȨÏÞÎÊÌâ¡£¡£
2ÐÐÃüÁî¸ã¶¨
grant all privileges on rogue.* to admin@localhost identified by 'admin' with grant option
grant all privileges on rogue.* to admin@'%' identified by 'admin' with grant option
¾µäÁË¡£¡£¡£
ħÁ¦Ë½·þÍøÒ³¶Ë¸ã¶¨¿©~~ ......