Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(100), GETDATE(), 4): 16.05.06
Select CONVERT(varchar(100), GETDATE(), 5): 16-05-06
Select CONVERT(varchar(100), GETDATE(), 6): 16 05 06
Select CONVERT(varchar(100), GETDATE(), 7): 05 16, 06
Select CONVERT(varchar(100), GETDATE(), 8): 10:57:46
Select CONVERT(varchar(100), GETDATE(), 9): 05 16 2006 10:57:46:827AM
Select CONVERT(varchar(100), GETDATE(), 10): 05-16-06
Select CONVERT(varchar(100), GETDATE(), 11): 06/05/16
Select CONVERT(varchar(100), GETDATE(), 12): 060516
Select CONVERT(varchar(100), GETDATE(), 13): 16 05 2006 10:57:46:937
Select CONVERT(varchar(100), GETDATE(), 14): 10:57:46:967
Select CONVERT(varchar(100), GETDATE(), 20): 2006-05-16 10:57:47
Select CONVERT(varchar(100), GETDATE(), 21): 2006-05-16 10:57:47.157
Select CONVERT(varchar(100), GETDATE(), 22): 05/16/06 10:57:47 AM
Select CONVERT(varchar(100), GETDATE(), 23): 2006-05-16
Select CONVERT(varchar(100), GETDATE(), 24): 10:57:47
Select CONVERT(varchar(100), GETDATE(), 25): 2006-05-16 10:57:47.250
Select CONVERT(varchar(100), GETDATE(), 100): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 101): 05/16/2006
Select CONVERT(varchar(100), GETDATE(), 102): 2006.05.16
Select CONVERT(varchar(100), GETDATE(), 103): 16/05/2006
Select CONVERT(varchar(100), GETDATE(), 104): 16.05.2006
Select CONVERT(varchar(100), GETDATE(), 105): 16-05-2006
Select CONVERT(varchar(100), GETDATE(), 106): 16 05 2006
Select CONVERT(varchar(100), GETDATE(), 107): 05 16, 2006
Select CONVERT(varchar(100), GETDATE(), 108): 10:57:49
Select CONVERT(varchar(100), GETDATE(), 109): 05 16 2006 10:
ʹÓùý Access µÄÅóÓѶ¼ÖªµÀ£¬Access ÀïÓиö“ÊÇ/·ñ”Êý¾ÝÀàÐÍ£¬ÔÚ SQL Server ÖУ¬Ã»ÓÐÕâ¸öÃû³Æ£¬¶øʹÓà bit¡£ÔÚʹÓùý³ÌÖÐÓм¸µãÐèҪעÒâµÄ£º
£±¡¢bit Óë SQL Server µÄÕûÐͺÍÊý×ÖÊý¾ÝÏàËƵÄÊý×ÖÊý¾Ý£¬µ« bit ÁÐÖ»ÄÜ´æ´¢ 0 ºÍ 1¡£
£²¡¢ÔÚ²åÈë¡¢ÐÞ¸Ä bit Êý¾Ýʱ£¬Ê¹Óà 0 »ò 1 £¬¶ø²»ÊÇ false »ò true£¬bit ×Ö¶ ......
SQL ÖÐµÄ substring º¯ÊýÊÇÓÃÀ´×¥³öÒ»¸öÀ¸Î»×ÊÁÏÖеÄÆäÖÐÒ»²¿·Ö¡£Õâ¸öº¯ÊýµÄÃû³ÆÔÚ²»Í¬µÄ×ÊÁÏ¿âÖв»ÍêÈ«Ò»Ñù£º
MySQL: SUBSTR(), SUBSTRING()
Oracle: SUBSTR()
SQL Server: SUBSTRING()
×î³£Óõ½µÄ·½Ê½ÈçÏ (ÔÚÕâÀïÎÒÃÇÓÃSUBSTR()ΪÀý)£º
SUBSTR(str,pos): ÓÉ<str>ÖУ¬Ñ¡³öËùÓдӵÚ<pos>λÖÿªÊ¼ ......
×ö¸ö¾ØÕó£¬Æäʵ¾ÍÊǸö¶þάÊý×飬¹Ø¼üÊÇÒª´ÓÊý¾Ý¿âÀïµ÷ЩÊý¾Ý£¬sqlÓï¾ä²»ÊìÁ·£¬¾Í±ßѧ±ßÓã¬Í¬²½µØ¼ÇЩ±Ê¼Ç£¬·½±ã²éÔÄ
¹ØÓÚdistinctºÍorder by ·¢Á˸öÌû×Ó£¨µÚÒ»´ÎŶ£©
Ê×Ìû£º
ÓõÄÊÇoracleµÄÊý¾Ý¿â
Ä¿µÄÊÇÏëÑ¡³öΨһµÄuserid£¨ÔÓÐÖظ´Öµ£©,²¢ÇÒ°´ÕÕfileposÅÅÐò£¨ÔfileposÊÇ1£¬2£¬3.¡£¡£²»Öظ´µÄÐòºÅ£©
......
ÎÒÃÇʹÓÃoracleµÄÈ˶¼ÖªµÀ¿ÉÒÔͨ¹ýrownumαÁеõ½²éѯ½á¹ûÐòÁÐÇ°ÃæµÄÖ¸¶¨µÄÐУ¬ÎªÁËÏÂÃæ¸üºÃµÄ½øÐÐ˵Ã÷ÎÊÌ⣬ÎÒÃÇÏÈÀ´´´½¨Ò»¸öÊý¾Ý±ítable1£º
create table table1
(AAA integer primary key,
BBB varchar(30));
È»ºóÔÚtable1ÖвåÈë9ÌõÊý¾Ý£º
insert into table1 values (8, 'good');
insert into table1 values (7 ......