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

sql Ë÷Òý ´æ´¢¹ý³Ì

´æ´¢¹ý³Ì
Óŵ㣺
1.ÓÉÓÚÓ¦ÓóÌÐòËæ×Åʱ¼äÍÆÒƻ᲻¶Ï¸ü¸Ä£¬Ôöɾ¹¦ÄÜ£¬T£­SQL¹ý³Ì´úÂë»á±äµÃ¸ü¸´ÔÓ£¬StoredProcedureΪ·â×°´Ë´úÂëÌṩÁËÒ»¸öÌ滻λÖá£
2.Ö´Ðмƻ®£¨´æ´¢¹ý³ÌÔÚÊ×´ÎÔËÐÐʱ½«±»±àÒ룬Õ⽫²úÉúÒ»¸öÖ´Ðмƻ®£­£­ ʵ¼ÊÉÏÊÇ Microsoft SQL ServerΪÔÚ´æ´¢¹ý³ÌÖлñÈ¡ÓÉ T-SQL Ö¸¶¨µÄ½á¹û¶ø±ØÐë²ÉÈ¡µÄ²½ÖèµÄ¼Ç¼¡££©»º´æ¸ÄÉÆÐÔÄÜ¡£
........µ«sql serverа汾£¬Ö´Ðмƻ®ÒÑÕë¶ÔËùÓÐ T-SQL Åú´¦Àí½øÐÐÁË»º´æ£¬¶ø²»¹ÜËüÃÇÊÇ·ñÔÚ´æ´¢¹ý³ÌÖУ¬ËùÒÔû±È½ÏÓÅÊÆÁË¡£
3.´æ´¢¹ý³Ì¿ÉÒÔÓÃÓÚ½µµÍÍøÂçÁ÷Á¿£¬´æ´¢¹ý³Ì´úÂëÖ±½Ó´æ´¢ÓÚÊý¾Ý¿âÖУ¬ËùÒÔ²»»á²úÉú´óÁ¿T-sqlÓï¾äµÄ´úÂëÁ÷Á¿¡£
4.ʹÓô洢¹ý³ÌʹÄúÄܹ»ÔöÇ¿¶ÔÖ´Ðмƻ®µÄÖظ´Ê¹Óã¬ÓÉ´Ë¿ÉÒÔͨ¹ýʹÓÃÔ¶³Ì¹ý³Ìµ÷Óà (RPC) ´¦Àí·þÎñÆ÷ÉϵĴ洢¹ý³Ì¶øÌá¸ßÐÔÄÜ¡£RPC ·â×°²ÎÊýºÍµ÷Ó÷þÎñÆ÷¶Ë¹ý³ÌµÄ·½Ê½Ê¹ÒýÇæÄܹ»ÇáËɵØÕÒµ½Æ¥ÅäµÄÖ´Ðмƻ®£¬²¢Ö»Ðè²åÈë¸üеIJÎÊýÖµ¡£
5.¿Éά»¤ÐԸߣ¬¸üд洢¹ý³Ìͨ³£±È¸ü¸Ä¡¢²âÊÔÒÔ¼°ÖØв¿Êð³ÌÐò¼¯ÐèÒª½ÏÉÙµÄʱ¼äºÍ¾«Á¦¡£
6.´úÂ뾫¼òÒ»Ö£¬Ò»¸ö´æ´¢¹ý³Ì¿ÉÒÔÓÃÓÚÓ¦ÓóÌÐò´úÂëµÄ²»Í¬Î»Öá£
7.¸üºÃµÄ°æ±¾¿ØÖÆ£¬Í¨¹ýʹÓà Microsoft Visual SourceSafe »òij¸öÆäËûÔ´´úÂë¿ØÖƹ¤¾ß£¬Äú¿ÉÒÔÇáËɵػָ´µ½»òÒýÓþɰ汾µÄ´æ´¢¹ý³Ì¡£
8.ÔöÇ¿°²È«ÐÔ£º
a¡¢Í¨¹ýÏòÓû§ÊÚÓè¶Ô´æ´¢¹ý³Ì£¨¶ø²»ÊÇ»ùÓÚ±í£©µÄ·ÃÎÊȨÏÞ£¬ËüÃÇ¿ÉÒÔÌṩ¶ÔÌض¨Êý¾ÝµÄ·ÃÎÊ£»
b¡¢Ìá¸ß´úÂ밲ȫ£¬·ÀÖ¹ SQL×¢È루µ«Î´³¹µ×½â¾ö£¬ÀýÈ磬½«Êý¾Ý²Ù×÷ÓïÑÔ£­£­DML£¬¸½¼Óµ½ÊäÈë²ÎÊý£©£»
c¡¢SqlParameter ÀàÖ¸¶¨´æ´¢¹ý³Ì²ÎÊýµÄÊý¾ÝÀàÐÍ£¬×÷ΪÉî²ã´Î·ÀÓùÐÔ²ßÂÔµÄÒ»²¿·Ö£¬¿ÉÒÔÑéÖ¤Óû§ÌṩµÄÖµÀàÐÍ£¨µ«Ò²²»ÊÇÍòÎÞһʧ£¬»¹ÊÇÓ¦¸Ã´«µÝÖÁÊý¾Ý¿âÇ°µÃµ½¸½¼ÓÑéÖ¤£©¡£
1¡¢Ô¤±àÒ룬´æ´¢¹ý³ÌÔ¤ÏȱàÒëºÃ·ÅÔÚÊý¾Ý¿âÄÚ£¬¼õÉÙ±àÒëÓï¾äËù»¨µÄʱ¼ä¡£
2¡¢»º´æ£¬±àÒëºÃµÄ´æ´¢¹ý³Ì»á½øÈ뻺´æ£¬ËùÒÔ¶ÔÓÚ¾­³£Ö´ÐеĴ洢¹ý³Ì£¬³ýÁ˵ÚÒ»´ÎÖ´ÐÐÍ⣬ÆäËû´ÎÖ´ÐеÄËٶȻáÓÐÃ÷ÏÔÌá¸ß¡£
3¡¢¼õÉÙÍøÂç´«Ê䣬Ìرð¶ÔÓÚ´¦ÀíһЩÊý¾ÝµÄ´æ´¢¹ý³Ì£¬²»±ØÏñÖ±½ÓÓÃsqlÓï¾äʵÏÖÄÇÑù¶à´Î´«ËÍÊý¾Ýµ½¿Í»§¶Ë¡£
4¡¢¸üºÃµÄÀûÓ÷þÎñÆ÷Äڴ棬Ìرð¶ÔÓÚ´¦ÀíÖмäÊý¾ÝÁ¿²»´óµÄÇé¿ö£¬´æ´¢¹ý³ÌÖпÉÒÔÀûÓôæ·ÅÔÚÄÚ´æµÄ±í±äÁ¿¡£
ȱµã£º
1.Èç¹û¸ü¸Ä·¶Î§´óµ½ÐèÒª¶ÔÊäÈë´æ´¢¹ý³ÌµÄ²ÎÊý½øÐиü¸Ä£¬»òÕßÒª¸ü¸ÄÓÉÆä·µ»ØµÄÊý¾Ý£¬ÔòÄúÈÔÐèÒª¸üгÌÐò¼¯ÖеĴúÂëÒÔÌí¼Ó²ÎÊý¡¢¸üРGetValue() µ÷Ó㬵ȵȣ¬Õâʱºò¹À¼Æ±È½Ï·±ËöÁË¡£
2.¿ÉÒÆÖ²ÐÔ²î
ÓÉÓÚ´æ´¢¹ý³Ì½«Ó¦ÓóÌÐò


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

SQLÓïÑÔ»ù´¡£¨3£©

GROUP BY×Ó¾ä
Ö¸¶¨²éѯ½á¹ûµÄ·Ö×éÌõ¼þ
Óï·¨£ºGROUP BY [ALL] group_by_expression_r_r [,n]
      [WITH{CUBE|ROLLUP}]
group_by_expression_r_rÖ¸Ã÷·Ö×éÌõ¼þ£¬Í¨³£ÊÇÒ»¸öÁÐÃû£¬µ«²»ÄÜÊÇÁеıðÃû¡£
ALL·µ»ØËùÓвéѯ½á¹ûµÄ×éºÏ¡£Èç¹ûûÓÐÂú×ãwhere×Ó¾äµÄÊý¾ÝÔòÓÉNULLÖµ¹¹³ÉÊý¾Ý¡£ALLµÄÑ¡Ïî²»Ä ......

SQL INNER JOIN ¹Ø¼ü×Ö

SQL INNER JOIN ¹Ø¼ü×Ö
 
SQL INNER JOIN ¹Ø¼ü×Ö
ÔÚ±íÖдæÔÚÖÁÉÙÒ»¸öÆ¥Åäʱ£¬INNER JOIN ¹Ø¼ü×Ö·µ»ØÐС£
INNER JOIN ¹Ø¼ü×ÖÓï·¨
SELECT column_name(s)
from table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_name
×¢ÊÍ£ºINNER JOIN Óë JOIN ÊÇÏàͬµÄ¡£
ԭʼµÄ±í (ÓÃÔÚÀ ......

SQL LEFT JOIN ¹Ø¼ü×Ö

SQL LEFT JOIN ¹Ø¼ü×Ö
 
SQL LEFT JOIN ¹Ø¼ü×Ö
LEFT JOIN ¹Ø¼ü×Ö»á´Ó×ó±í (table_name1) ÄÇÀï·µ»ØËùÓеÄÐУ¬¼´Ê¹ÔÚÓÒ±í (table_name2) ÖÐûÓÐÆ¥ÅäµÄÐС£
LEFT JOIN ¹Ø¼ü×ÖÓï·¨
SELECT column_name(s)
from table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
×¢ÊÍ£ºÔÚÄ ......

SQL RIGHT JOIN ¹Ø¼ü×Ö

SQL RIGHT JOIN ¹Ø¼ü×Ö
SQL RIGHT JOIN ¹Ø¼ü×Ö
RIGHT JOIN ¹Ø¼ü×Ö»áÓÒ±í (table_name2) ÄÇÀï·µ»ØËùÓеÄÐУ¬¼´Ê¹ÔÚ×ó±í (table_name1) ÖÐûÓÐÆ¥ÅäµÄÐС£
RIGHT JOIN ¹Ø¼ü×ÖÓï·¨
SELECT column_name(s)
from table_name1
RIGHT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
×¢ÊÍ£ºÔÚijЩÊý ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ