Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL SERVER ÓÃsqlÓï¾äÈçºÎ»ñµÃµ±Ç°ÏµÍ³Ê±¼ä


SQL SERVER 2000ÓÃsqlÓï¾äÈçºÎ»ñµÃµ±Ç°ÏµÍ³Ê±¼ä
¾ÍÊÇÓÃGETDATE();
SqlÖеÄgetDate()2008Äê01ÔÂ08ÈÕ ÐÇÆÚ¶þ 14:59
Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2008 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/08
Select CONVERT(varchar(100), GETDATE(), 2): 08.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/08
Select CONVERT(varchar(100), GETDATE(), 4): 16.05.08
Select CONVERT(varchar(100), GETDATE(), 5): 16-05-08
Select CONVERT(varchar(100), GETDATE(), 6): 16 05 08
Select CONVERT(varchar(100), GETDATE(), 7): 05 16, 08
Select CONVERT(varchar(100), GETDATE(), 8): 10:57:46
Select CONVERT(varchar(100), GETDATE(), 9): 05 16 2008 10:57:46:827AM
Select CONVERT(varchar(100), GETDATE(), 10): 05-16-08
Select CONVERT(varchar(100), GETDATE(), 11): 08/05/16
Select CONVERT(varchar(100), GETDATE(), 12): 080516
Select CONVERT(varchar(100), GETDATE(), 13): 16 05 2008 10:57:46:937
Select CONVERT(varchar(100), GETDATE(), 14): 10:57:46:967
Select CONVERT(varchar(100), GETDATE(), 20): 2008-05-16 10:57:47
Select CONVERT(varchar(100), GETDATE(), 21): 2008-05-16 10:57:47.157
Select CONVERT(varchar(100), GETDATE(), 22): 05/16/08 10:57:47 AM
Select CONVERT(varchar(100), GETDATE(), 23): 2008-05-16
Select CONVERT(varchar(100), GETDATE(), 24): 10:57:47
Select CONVERT(varchar(100), GETDATE(), 25): 2008-05-16 10:57:47.250
Select CONVERT(varchar(100), GETDATE(), 100): 05 16 2008 10:57AM
Select CONVERT(varchar(100), GETDATE(), 101): 05/16/2008
Select CONVERT(varchar(100), GETDATE(), 102): 2008.05.16
Select CONVERT(varchar(100), GETDATE(), 103): 16/05/2008
Select CONVERT(varchar(100), GETDATE(), 104): 16.05.2008
Select CONVERT(varchar(100), GETDATE(), 105): 16-05-2008
Select CONVERT(varchar(100), GETDATE(), 106): 16 05 2008
Select CONVERT(varchar(100), GETDATE(), 107): 05 16, 2008
Select CONVERT(varchar(100), GETDATE(), 108): 10:57:49
Select CONVERT(varchar(100), GETDATE(), 109): 05 16 2008
10:57:49:437AM


Ïà¹ØÎĵµ£º

´Ó¡¾¸÷´óÈí¼þ¹«Ë¾±ÊÊÔѹÖáÌ⡿ѧϰSQLÓï¾ä

´Ó²©¿ÍÔ°Öп´µ½Ò»ÆªÎÄÕ£¬½éÉÜ´óÈí¼þ¹«Ë¾ÃæÊÔʱ³£³£»á³öµÄÁ½µÀSQLÌ⣨¼û¸½Â¼£©¡£
ÎÒ¾õµÃÊÜÒæºÜ¶à£¬ÔÚ´Ë֮ǰ£¬ÎÒÒ»Ö±¾õµÃ£¬SQL2008ËƺõÌṩÁËÕâ·½ÃæµÄÖ§³Ö£¬µ«¸üµÍµÄ°æ±¾£¬°üÀ¨2005£¬·ÇÓαê×ö²»³öÀ´£¨Ë®Æ½¹»²Ë£©¡£×ܽáÐĵÃÈçÏ£º
1¡¢    Ç¿´óµÄgroup by
1  select stdname,
2  isnull( ......

ʹÄãµÄ SQL Óï¾äÍêÈ«ÓÅ»¯

ÎÒÃÇÒª×öµ½²»µ«»áдSQL£¬»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQLÓï¾ä¡£
£¨1£©Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
OracleµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç ......

sqlÖ®truncate ¡¢deleteÓëdropÇø±ð

truncate ¡¢deleteÓëdropÇø±ð
Ïàͬµã£º
truncate ºÍ²»´ø where ×Ó¾äµÄ delete£¬ÒÔ¼° drop ¶¼»áɾ³ý±íÄÚµÄÊý¾Ý
²»Í¬µã£º
1. truncate ºÍ delete ֻɾ³ýÊý¾Ý²»É¾³ý±íµÄ½á¹¹(¶¨Òå)
drop Óï¾ä½«É¾³ý±íµÄ½á¹¹±»ÒÀÀµµÄÔ¼Êø(constrain)¡¢´¥·¢Æ÷(trigger)¡¢Ë÷Òý(index)£»ÒÀÀµÓڸñíµÄ´æ´¢¹ý³Ì/º¯Êý½«±£Áô,µ«ÊDZäΪ invalid ×´Ì ......

sqlµÄjoin

¶ÔÓÚÎÒÃÇÕâЩ½öÓõ½sql¼òµ¥²éѯ¿ª·¢ÈËÔ±À´Ëµ£¬¿ÉÄÜÖ»Á˽âһЩ»ù±¾µÄsqlº¯ÊýºÍ<>=ÕâÑùµÄÌõ¼þÓï¾ä£¬½ñÌìÒ»¸öÅóÓÑÎÊÆð£ºÄ¬ÈϵÄjoinÊÇouter»¹ÊÇinner¡£¡£¡£¡£
ÌصØÊÕ¼¯ÁËһЩ¶«Î÷£¬Ò²Ìù³öÀ´ºÍ´ó¼Ò·ÖÏíÏ£º
joinleft outer join=left join ,   right outer join=right join,     inner jo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ