SQL Server 2000£«ADO.NETʵÏÖ²¢·¢¿ØÖÆ ×ªÔØ
³£¼û²¢·¢²¢·¢Ò»ÖÂÐÔÎÊÌâ°üÀ¨£º¶ªÊ§µÄÐ޸ġ¢²»¿ÉÖظ´¶Á¡¢¶ÁÔàÊý¾Ý¡¢»ÃÓ°¶Á£¨»ÃÓ°¶ÁÔÚһЩ×ÊÁÏÖÐÍùÍùÓë²»¿ÉÖظ´¶Á¹éΪһÀࣩ¡£
2.2.1.1 ¶ªÊ§ÐÞ¸Ä
ÏÂÃæÎÒÃÇÏÈÀ´¿´Ò»¸öÀý×Ó£¬ËµÃ÷²¢·¢²Ù×÷´øÀ´µÄÊý¾ÝµÄ²»Ò»ÖÂÐÔÎÊÌâ¡£
¿¼ÂÇ·É»ú¶©Æ±ÏµÍ³ÖеÄÒ»¸ö»î¶¯ÐòÁÐ:
¼×ÊÛƱµã£¨¼×ÊÂÎñ£©¶Á³öijº½°àµÄ»úƱÓà¶îA,ÉèA=16.
ÒÒÊÛƱµã£¨ÒÒÊÂÎñ£©¶Á³öͬһº½°àµÄ»úƱÓà¶îA,ҲΪ16.
¼×ÊÛƱµãÂô³öÒ»ÕÅ»úƱ,ÐÞ¸ÄÓà¶îA←A-1.ËùÒÔAΪ15,°ÑAд»ØÊý¾Ý¿â.
ÒÒÊÛƱµãÒ²Âô³öÒ»ÕÅ»úƱ,ÐÞ¸ÄÓà¶îA←A-1.ËùÒÔAΪ15,°ÑAд»ØÊý¾Ý¿â.
½á¹ûÃ÷Ã÷Âô³öÁ½ÕÅ»úƱ£¬Êý¾Ý¿âÖлúƱÓà¶îÖ»¼õÉÙ1¡£
¹éÄÉÆðÀ´¾ÍÊÇ£ºÁ½¸öÊÂÎñT1ºÍT2¶ÁÈëͬһÊý¾Ý²¢Ð޸ģ¬T2Ìá½»µÄ½á¹ûÆÆ»µÁËT1Ìá½»µÄ½á¹û£¬µ¼ÖÂT1µÄÐ޸ı»¶ªÊ§¡£Ç°ÎÄ£¨2.1.4Êý¾Ýɾ³ýÓë¸üУ©ÖÐÌáµ½µÄÎÊÌâ¼°½â¾ö°ì·¨ÍùÍùÊÇÕë¶Ô´ËÀಢ·¢ÎÊÌâµÄ¡£µ«ÈÔÈ»Óм¸ÀàÎÊÌâͨ¹ýÉÏÃæµÄ·½·¨½â¾ö²»ÁË£¬ÄǾÍÊÇ£º
2.2.1.2 ²»¿ÉÖظ´¶Á
²»¿ÉÖظ´¶ÁÊÇÖ¸ÊÂÎñT1¶ÁÈ¡Êý¾Ýºó£¬ÊÂÎñT2Ö´ÐиüвÙ×÷£¬Ê¹T1ÎÞ·¨ÔÙÏÖÇ°Ò»´Î¶ÁÈ¡½á¹û¡£¾ßÌåµØ½²£¬²»¿ÉÖظ´¶Á°üÀ¨ÈýÖÖÇé¿ö£º
ÊÂÎñT1¶ÁȡijһÊý¾Ýºó£¬ÊÂÎñT2¶ÔÆä×öÁËÐ޸ģ¬µ±ÊÂÎñ1ÔٴζÁ¸ÃÊý¾Ýʱ£¬µÃµ½ÓëÇ°Ò»´Î²»Í¬µÄÖµ¡£ÀýÈ磬T1¶ÁÈ¡B=100½øÐÐÔËË㣬T2¶ÁȡͬһÊý¾ÝB£¬¶ÔÆä½øÐÐÐ޸ĺó½«B=200д»ØÊý¾Ý¿â¡£T1ΪÁ˶ԶÁȡֵУ¶ÔÖضÁB£¬BÒÑΪ200£¬ÓëµÚÒ»´Î¶ÁÈ¡Öµ²»Ò»Ö¡£
ÊÂÎñT1°´Ò»¶¨Ìõ¼þ´ÓÊý¾Ý¿âÖжÁÈ¡ÁËijЩÊý¾Ý¼Ç¼ºó£¬ÊÂÎñT2ɾ³ýÁËÆäÖв¿·Ö¼Ç¼£¬µ±T1Ôٴΰ´ÏàͬÌõ¼þ¶ÁÈ¡Êý¾Ýʱ£¬·¢ÏÖijЩ¼Ç¼ÉñÃܵØÏûʧÁË¡£
ÊÂÎñT1°´Ò»¶¨Ìõ¼þ´ÓÊý¾Ý¿âÖжÁȡijЩÊý¾Ý¼Ç¼ºó£¬ÊÂÎñT2²åÈëÁËһЩ¼Ç¼£¬µ±T1Ôٴΰ´ÏàͬÌõ¼þ¶ÁÈ¡Êý¾Ýʱ£¬·¢ÏÖ¶àÁËһЩ¼Ç¼¡££¨ÕâÒ²½Ð×ö»ÃÓ°¶Á£©
2.2.1.3 ¶Á"Ôà"Êý¾Ý
¶Á"Ôà"Êý¾ÝÊÇÖ¸ÊÂÎñT1ÐÞ¸ÄijһÊý¾Ý£¬²¢½«Æäд»Ø´ÅÅÌ£¬ÊÂÎñT2¶ÁȡͬһÊý¾Ýºó£¬T1ÓÉÓÚijÖÖÔÒò±»³·Ïû£¬ÕâʱT1ÒÑÐ޸ĹýµÄÊý¾Ý»Ö¸´ÔÖµ£¬T2¶Áµ½µÄÊý¾Ý¾ÍÓëÊý¾Ý¿âÖеÄÊý¾Ý²»Ò»Ö£¬ÔòT2¶Áµ½µÄÊý¾Ý¾ÍΪ"Ôà"Êý¾Ý£¬¼´²»ÕýÈ·µÄÊý¾Ý¡£
²úÉúÉÏÊöÈýÀàÊý¾Ý²»Ò»ÖÂÐÔµÄÖ÷ÒªÔÒòÊDz¢·¢²Ù×÷ÆÆ»µÁËÊÂÎñµÄ¸ôÀëÐÔ¡£²¢·¢¿ØÖƾÍÊÇÒªÓÃÕýÈ·µÄ·½Ê½µ÷¶È²¢·¢²Ù×÷£¬Ê¹Ò»¸öÓû§ÊÂÎñµÄÖ´Ðв»ÊÜÆäËüÊÂÎñµÄ¸ÉÈÅ£¬´Ó¶ø±ÜÃâÔì³ÉÊý¾ÝµÄ²»Ò»ÖÂÐÔ¡£
2.2.2 ²¢·¢Ò»ÖÂÐÔÎÊÌâµÄ½â¾ö°ì·¨
2.2.2.1 ·âËø£¨Locking£©
·âËøÊÇʵÏÖ²¢·¢¿ØÖƵÄÒ»¸ö·Ç³£ÖØÒªµÄ¼¼Êõ¡£Ëùν·âËø¾ÍÊÇÊÂÎñTÔÚ¶Ôij¸öÊý¾Ý¶ÔÏóÀýÈç±í¡¢¼Ç¼µÈ²Ù×÷֮ǰ£¬ÏÈÏòϵͳ·¢³öÇëÇ󣬶ÔÆä¼ÓËø¡£¼ÓËøºóÊÂÎñT¾Í¶Ô¸
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
Ò»¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóµÄÔªËظöÊý£¬·½·¨ºÜ¼òµ¥£¬¾ÍÊÇ¿´×Ö·û´®ÖдæÔÚ¶àÉÙ¸ö·Ö¸ô·ûºÅ£¬È»ºóÔÙ¼ÓÒ»£¬¾ÍÊÇÒªÇóµÄ½á¹û¡£
CREATE function Get_StrArrayLength
(
@str varchar(1024), --Òª·Ö¸îµÄ×Ö·û´®
@split varchar(10) --·Ö¸ô·ûºÅ
)
......
½ñÌì°²×°sql server2000.ϵͳÊÇXP professional¡£Ê×ÏÈÏÈ°²×°sqlserverÆóÒµ°æµÄ£¬Ö»ÄÜ°²×°¿Í»§¶Ë£»È»ºó°²×°sqlserver¿ª·¢°æ£¬¾Í ±»¹ÒÆð£¬Òò´ËÍøÉÏËÑÂÞÏà¹ØÐÅÏ¢¡£
1¡¢ Èô³öÏÖ¹ÒÆðºó£¬¿É°´ÏÂÁвÙ×÷½øÐУ¬±¾ÈËÒѾÊÔÓùý£º
ÔÚÔËÐд°¿ÚÊäÈëregedit£¬´ò¿ª×¢²á±í±à¼Æ÷£¬ÔÚHKEY_LOCA ......
sql serverÊý¾ÝÀàÐÍcharºÍnchar,varcharºÍnvarchar,textºÍntextÔÊÐíµÄ×Ö·û³¤¶È
×Ö·û´®
char
¹Ì¶¨³¤¶ÈµÄ·Ç Unicode ×Ö·ûÊý¾Ý£¬×î´ó³¤¶ÈΪ 8,000 ¸ö×Ö·û¡£
varchar
¿É±ä³¤¶ÈµÄ·Ç Unicode Êý¾Ý£¬×Ϊ 8,000 ¸ö×Ö·û¡£
text
¿É±ä³¤¶ÈµÄ·Ç Unicode Êý¾Ý£¬×î´ó³¤¶ÈΪ 2^31 - 1 (2,147,483,647) ¸ö×Ö·û¡£
Unicode ×Ö·û´®
......
ϵͳº¯Êý
1.case when ... then ..else ..end(ÓÃÓÚ¶ÔÌõ¼þ½øÐвâÊÔ)
e.Select id,case when name='deepwishly' then 'ÀÏ´ó' else 'ÆäËû' end as Type
ÏÔʾ id type
1 ÀÏ´ó
2.cast()/convert() Ç°Õß¾ßÓÐANSI SQL-92¼æÈÝÐÔ£¬ºóÕß¹¦ÄܸüÇ ......