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

sql ×Ö·û´®´¦Àíº¯Êý

¡¾×ª¡¿Ò»Ð©³£ÓõÄsqlÓï¾ä×Ö·û´®´¦Àí£¬×ªÓÚÕâÀÒÔ·½±ãʹÓÃ
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ 255 Ö®¼äµÄASCII ÂëÖµ£¬CHAR£¨£© ·µ»ØNULL ¡£
3¡¢LOWER()ºÍUPPER()
LOWER()½«×Ö·û´®È«²¿×ªÎªÐ¡Ð´£»UPPER()½«×Ö·û´®È«²¿×ªÎª´óд¡£
4¡¢STR()
°ÑÊýÖµÐÍÊý¾Ýת»»Îª×Ö·ûÐÍÊý¾Ý¡£
STR (<float_expression>[£¬length[£¬ <decimal>]])
length Ö¸¶¨·µ»ØµÄ×Ö·û´®µÄ³¤¶È£¬decimal Ö¸¶¨·µ»ØµÄСÊýλÊý¡£Èç¹ûûÓÐÖ¸¶¨³¤¶È£¬È±Ê¡µÄlength ֵΪ10£¬ decimal ȱʡֵΪ0¡£
µ±length »òÕßdecimal Ϊ¸ºÖµÊ±£¬·µ»ØNULL£»
µ±length СÓÚСÊýµã×ó±ß£¨°üÀ¨·ûºÅ룩µÄλÊýʱ£¬·µ»Ølength ¸ö*£»
ÏÈ·þ´Ólength £¬ÔÙÈ¡decimal £»
µ±·µ»ØµÄ×Ö·û´®Î»ÊýСÓÚlength £¬×ó±ß²¹×ã¿Õ¸ñ¡£
¶þ¡¢È¥¿Õ¸ñº¯Êý
1¡¢LTRIM() °Ñ×Ö·û´®Í·²¿µÄ¿Õ¸ñÈ¥µô¡£
2¡¢RTRIM() °Ñ×Ö·û´®Î²²¿µÄ¿Õ¸ñÈ¥µô¡£
Èý¡¢È¡×Ó´®º¯Êý
1¡¢left() 
LEFT (<character_expression>£¬ <integer_expression>)
·µ»Øcharacter_expression ×óÆð integer_expression ¸ö×Ö·û¡£
2¡¢RIGHT() 
RIGHT (<character_expression>£¬ <integer_expression>)
·µ»Øcharacter_expression ÓÒÆð integer_expression ¸ö×Ö·û¡£
3¡¢SUBSTRING()
SUBSTRING (<expression>£¬ <starting_ position>£¬ length)
·µ»Ø´Ó×Ö·û´®×ó±ßµÚstarting_ position ¸ö×Ö·ûÆðlength¸ö×Ö·ûµÄ²¿·Ö¡£
ËÄ¡¢×Ö·û´®±È½Ïº¯Êý
1¡¢CHARINDEX()
·µ»Ø×Ö·û´®ÖÐij¸öÖ¸¶¨µÄ×Ó´®³öÏֵĿªÊ¼Î»Öá£
CHARINDEX (<’substring_expression’>£¬ <expression>)
ÆäÖÐsubstring _expression ÊÇËùÒª²éÕÒµÄ×Ö·û±í´ïʽ£¬expression ¿ÉΪ×Ö·û´®Ò²¿ÉΪÁÐÃû±í´ïʽ¡£Èç¹ûûÓз¢ÏÖ×Ó´®£¬Ôò·µ»Ø0 Öµ¡£
´Ëº¯Êý²»ÄÜÓÃÓÚTEXT ºÍIMAGE Êý¾ÝÀàÐÍ¡£
2¡¢PATINDEX()
·µ»Ø×Ö·û´®ÖÐij¸öÖ¸¶¨µÄ×Ó´®³öÏֵĿªÊ¼Î»Öá£
PATINDEX (<’%substring _expression%’>£¬ <column_ name>)ÆäÖÐ×Ó´®±í´ïʽǰºó±ØÐëÓаٷֺœ%”·ñÔò·µ»ØֵΪ0¡£
ÓëCHARINDEX º¯Êý²»Í¬µÄÊÇ£¬PATINDEXº¯ÊýµÄ×Ó´®ÖпÉÒÔʹÓÃͨÅä·û£¬ÇҴ˺¯Êý¿ÉÓÃÓÚCHAR¡¢ VARCHAR ºÍTEXT Êý¾Ý


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

SQL ServerÃÜÂëÆƽ⹤¾ß¼ò½é

ÔÚ¶ÔSQL ServerϵͳִÐÐÈëÇÖ²âÊÔ»òÕ߸ü¸ß¼¶±ðµÄ°²È«Éó¼Æʱ£¬ÓÐÒ»ÖÖ²âÊÔ²»Ó¦¸Ã±»ºöÂÔ£¬ÄǾÍÊÇSQL ServerÃÜÂë²âÊÔ¡£ÕâÒ»µã¿´ÆðÀ´ÏÔ¶øÒ×¼û£¬µ«ÊǺܶàÈ˶¼»áºöÂÔËü¡£
¡¡¡¡ÃÜÂë²âÊÔ¿ÉÒÔ°ïÖú¼ì²é¶ñÒâÈëÇÖÕß»òÕßÍⲿ¹¥»÷Õߣ¬²âÊÔËûÃÇҪǿÐнøÈëÊý¾Ý¿âÓжàÈÝÒ×£¬¶øÇÒ»¹¿ÉÒÔÈ·±£SQL ServerÓû§¶ÔËûÃǵÄÕ˺ŸºÔð¡£´ËÍ⣬²âÊÔÃÜÂëµÄ© ......

SQL ServerÖÐÒÑÂúÊÂÎñÈÕÖ¾Ô­ÒòµÄ¼ì²â

¶ÔÓÚSQL ServerÊý¾Ý¿â¹ÜÀíÔ±À´½²£¬ÒÑÂúÊÂÎñÈÕÖ¾ÊÇÒ»¸öËöËéµÄ£¬µ«Óֺܳ£¼ûµÄÎÊÌâ¡£ËüÄÜÒý·¢ÊÂÎñµÄÌáÇ°ÖÕÖ¹£¬ÉõÖÁͨ¹ý×èÖ¹ËùÓÐÊÂÎñµÄÒýÈ룬´Ó¶øÒýÆðϵͳµÄ±ÀÀ£¡£¶ÔÓÚÊý¾Ý¿â¹ÜÀíÔ±À´Ëµ£¬¹Ø¼üÊÇÀí½â½«Òª·¢ÉúµÄÇé¿ö£¬ÒÔ±ãËûÃÇ¿ÉÒÔ×·×ÙÒýÆðÎÊÌâµÄÔ­Òò¡£ ÊÂÎñÈÕÖ¾Ìî³ä·½Ê½
¡¡¡¡ÒÔÏÂÊÇһЩ¿ÉÄÜÒýÆðÊÂÎñÈÕÖ¾ÌîÂúµÄÔ­Òò£º
¡¡¡¡ÌîÂúµ ......

SQLÖаѲéѯ³öÀ´µÄ½á¹ûÓöººÅÁ¬½ÓÆðÀ´

SELECT A,B=stuff((select ' ' + '×Ö¶ÎC£º' + C + ',×Ö¶ÎD£º'  + D) + ';'  from tbl WHERE (key= 'Ìõ¼þ') for xml path('')) , 1 , 1 ,'')
from tbl
WHERE (key= 'Ìõ¼þ')
group by key
ÀýÈ磺һ¸ö±íÖÐkeyΪAAµÄ¼Ç¼ÓÐ2Ìõ£¬µÚÒ»ÌõÖÐ×Ö¶ÎCµÄֵΪCC£¬×Ö¶ÎDµÄֵΪDD£¬µÚ¶þÌõÖÐ×Ö¶ÎCµÄֵΪCCC£¬×Ö¶ÎDµÄֵΪ ......

Linq To Sql½ø½×ϵÁУ¨Ò»£© ´ÓÓ³Éä½²Æð

±¾ÏµÁУ¬»ò¶à»òÉÙ£¬Ö±½Ó»ò¼ä½ÓÒÀÀµÈëÃÅϵÁÐ֪ʶ¡£µ«£¬ÒÀÈ»×·Çó¶ÀÁ¢³ÉÕ¡£Òò±¾ÎÄ×÷ÕßˮƽÓÐÏÞ£¬ÎÄÖдíÎóÄÑÃ⣬¾´Çë¶ÁÕßÖ¸³ö²¢Á½⡣±¾ÏµÁн«»áºÍÈëÃŲ¢´æ¡£
°¸Àý
ij¾ý±»ÑûΪһ³¬ÊÐÉè¼ÆÊý¾Ý¿â£¬ÓÃÀ´´æ´¢Êý¾Ý¡£¸Ã¾ý¸ù¾Ý¸Ã³¬ÊÐÖÐʵ¼Ê³öÏֵĶÔÏó£¬Éè¼ÆÁËCustomer, Employee£¬Order, ProductµÈ±í£¬ÓÃÀ´±£´æÏàÓ¦µÄ¿Í»§£¬Ô±¹¤£¬¶© ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ