Microsoft SQL Server ²éѯ´¦ÀíÆ÷µÄÄÚ²¿»úÖÆÓë½á¹¹
ÕªÒª£º±¾ÎĽéÉÜÁËÔÚ¿Í»§»úÉÏ´¦Àí Microsoft sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) ²éѯµÄ·½Ê½£¬¸÷ÖÖ¿Í»§»úÓë sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) µÄ½»»¥·½Ê½£¬ÒÔ¼° sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) ÔÚ´¦Àí¿Í»§»ú³ÌÐòµÄÇëÇóʱÐèÒªÍê³ÉµÄ¹¤×÷¡£
¼ò½é
¡¡¡¡Microsoft(R) sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨)(TM) ÄÚ²¿»úÖƺͽṹÊÇÒ»¸ö·Ç³£´óµÄÖ÷Ì⣬Òò´Ë±¾ÎĽöÏÞÓÚ³ÌÐò¿ª·¢ÈËÔ±¸ÐÐËȤµÄÎÊÌ⣬¼¯ÖÐÑо¿ÆäËûÔ´ÖÐûÓг¹µ×ÌÖÂÛµÄÎÊÌâ¡£ÔÚÌÖÂÛ sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) µÄ½á¹¹Ê±£¬ÎÒÃÇÖ÷Òª¹Û²ì¿Í»§»úµÄ´¦Àí¹ý³Ì£¬Ñо¿²»Í¬µÄ¿Í»§»ú³ÌÐòÓë sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) µÄ½»»¥·½Ê½£¬ÒÔ¼° sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) ÈçºÎ´¦Àí¿Í»§»úµÄÇëÇó¡£»¹ÓÐһЩÌÖÂÛ sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) ÆäËû·½ÃæµÄÐÅÏ¢Ô´£¬ÌرðÊÇ Microsoft Press ³ö°æµÄ Inside sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) 7.0£¬×÷ÕßÊÇ Ron Soukup ºÍ Kalen Delaney£¬Õâ±¾Êé·Ç³£ÏêϸµØÌÖÂÛÁË sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) ´æ´¢ÒýÇæµÄÄÚ²¿»úÖƺʹ¦Àí·½·¨£¬²»¹ý¶Ô²éѯ´¦ÀíÆ÷µÄÌÖÂÛ²»¹»ÉîÈë¡£±¾ÎÄÕýÌî²¹ÁËÕâ¸ö¿Õ°×¡£
¡¡¡¡ÎÒÃÇÆÚÍû±¾ÎÄÓÐÖúÓÚ¶ÁÕß±àд³ö¸üºÃµÄÓ¦ÓóÌÐò¡£Í¨¹ý±¾ÎÄ£¬¶ÁÕß»áÔÚÌá¸ß³ÌÐòÐÔÄÜ·½ÃæµÃµ½ÐµÄÆô·¢£¬²úÉúеÄÀí½â¡£
sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) ÊÇÒ»ÖÖ¿Í»§»ú/·þÎñÆ÷ϵͳ
¡¡¡¡¶àÄêÀ´£¬sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) Ò»Ö±±»ÈÏΪÊÇÒ»ÖÖ¿Í»§»ú/·þÎñÆ÷ϵͳ¡£ÊÂʵÉÏ£¬Sybase DataServer£¨ÒÔ´ËΪ»ù´¡¿ª·¢ÁËÔʼµÄ sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨)£©ÕýÊǵÚÒ»¸ö×÷Ϊ¿Í»§»ú/·þÎñÆ÷ϵͳ¿ª·¢µÄÉÌÓùØϵÊý¾Ý¿âϵͳ¡£ÄÇÕâÓÖ˵Ã÷ÁËʲôÄØ£¿Õâ²»Ö»Òâζ×Å sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) ÊÇÒ»¸öË«²ãϵͳ¡£´Ó´«Í³ÉÏ¿´£¬Ë«²ãϵͳÒâζ×Å¿Í»§»úÓ¦ÓóÌÐòÔËÐÐÔÚһ̨»úÆ÷ÉÏ£¬ÏòÁíһ̨¼ÆËã»úÉϵķþÎñÆ÷·¢ËÍÇëÇ󡣶ø¶ÔÓÚ sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨)£¬¿Í»§»ú/·þÎñÆ÷Òâζ×Å sql server(WINDOWSƽ̨ÉÏÇ¿´óµÄÊý¾Ý¿âƽ̨) µÄ×é³É²¿·Ö£¬¼´¿Í»§»ú API ²¿·Ö£¬×¤ÁôÔÚ´¦Àí½á¹¹ÖеÄÔ¶¶Ë£¬Óë·þÎñÆ÷×é¼þ±¾ÉíÊÇ·Ö¿ªµÄ¡£
¡¡¡¡ÔÚµäÐ͵ÄË«²ãÄ£ÐÍÖУ¬¿Í»§»ú³ÌÐò²¿·ÖפÁôÔŲ́ʽ»úÉÏ£¬¾ßÓдóÁ¿¿Í»§»úÓ¦ÓóÌÐòÂß¼ºÍÒµÎñÂß¼£¬²¢ÇÒ»áÖ±½ÓÏòÊý¾Ý¿âϵͳ·¢³öÇëÇó¡£È»ºó£¬¿Í»§»úµÃµ½·þÎñÆ÷ÏìÓ¦ÕâЩÇëÇóËù·µ»ØµÄÊý¾Ý¡£
¡¡¡¡Èý²ãϵͳҲ²ÉÓÃÁËÍ
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
DATEDIFF
·µ»Ø¿çÁ½¸öÖ¸¶¨ÈÕÆÚµÄÈÕÆÚºÍʱ¼ä±ß½çÊý¡£
Ò»¡¢ Óï·¨
DATEDIFF ( datepart , startdate , enddate )
¶þ¡¢²ÎÊý
datepar ......
ΪÁ˹«Ë¾¿¼ÇÚϵͳµÄÐèÒª
±àдµÄ¼¸¸ö¼òµ¥´æ´¢¹ý³Ì(¿ÉÒÔÊÖ¶¯ÔËÐÐ,Ò²¿ÉÒÔÉèÖÃÊÂÎñ×Ô¶¯ÔËÐÐ!¸Ð¾õ»¹ÐбȽÏͨÓÃ,д³öÀ´¹²ÏíÏÂ)
Calendar±í½á¹¹ºÜ¼òµ¥,2¸ö×Ö¶Î:
fdDate ÈÕÆÚ
fdType ¿¼ÇÚÀàÐÍ(¹¤×÷ÈÕN,ÖÜÄ©W,½Ú¼ÙÈÕH[ÐèÒª¸ù¾ÝÐèÒª×Ô¼ºÐÞ¸Ä])
--ÅжÏÒ»¶Îʱ¼ä·¶Î§ÄڵŤ×÷ÈÕ£¨N£©ºÍÖÜÄ©£¨W£©
Create PR ......
Éè¼ÆÔÔò
·ûºÅÈý´ó·¶Ê½£¨Ã¿Ò»Áбí´ïÒ»¸öÒâ˼£¬Ã¿Ò»Ðдú±íÒ»¸öʵÀý/ÿһÐÐÓÐΨһ¼ü/±íÄÚûÓÐÆäËü±íµÄ·ÇÖ÷¼üÐÅÏ¢£©
ÿ¸ö±íÓ¦¸ÃÓеÄ3¸öÓÐÓÃ×ֶΣ¨¼Ç¼´´½¨»ò¸üÐÂʱ¼ä/¼Ç¼´´½¨Õß/¼Ç¼°æ±¾£©
±ÜÃâ±£Áô×Ö
±íÓ¦±ÜÃâ¿ÉΪ¿ÕµÄÁÐ
ÃüÃû¹æ·¶
±í
±íÃûÈçOr ......
Case¾ßÓÐÁ½ÖÖ¸ñʽ¡£¼òµ¥Caseº¯ÊýºÍCaseËÑË÷º¯Êý¡£
--¼òµ¥Caseº¯Êý
CASE sex
WHEN '1' THEN 'ÄÐ'
WHEN '2' THEN 'Å®'
ELSE 'ÆäËû' END
--CaseËÑË÷º¯Êý
CASE WHEN sex = '1' THEN 'ÄÐ'
&nbs ......