SQLÖеÄREPLACEÌæ»»×Ö·ûº¯Êý
SQLÖеÄREPLACEÌæ»»×Ö·ûº¯ÊýµÄÓ÷¨£¨Ê¹Ö®Ö§³Ötext/ntext£©
Óï·¨
REPLACE ( original-string, search-string, replace-string )
²ÎÊý
Èç¹ûÓÐij¸ö²ÎÊýΪ NULL£¬´Ëº¯Êý·µ»Ø NULL¡£
original-string ±»ËÑË÷µÄ×Ö·û´®¡£¿ÉΪÈÎÒⳤ¶È¡£
search-string ÒªËÑË÷²¢±» replace-string Ìæ»»µÄ×Ö·û´®¡£¸Ã×Ö·û´®µÄ³¤¶È²»Ó¦³¬¹ý 255 ¸ö×Ö½Ú¡£Èç¹û search-string ÊÇ¿Õ×Ö·û´®£¬Ôò°´ÔÑù·µ»ØÔʼ×Ö·û´®¡£
replace-string ¸Ã×Ö·û´®ÓÃÓÚÌæ»» search-string¡£¿ÉΪÈÎÒⳤ¶È¡£Èç¹û replacement-string ÊÇ¿Õ×Ö·û´®£¬Ôòɾ³ý³öÏÖµÄËùÓÐ search-string¡£
Àý×Ó£º
UPDATE tableName SET recordName=REPLACE(recordName,'abc','ddd')
½«±ítableNameÖеÄrecordName×Ö¶ÎÖÐµÄ abc Ì滻Ϊ ddd
Õâ¸öº¯ÊýÓÐÒ»µã²»×ãÊDz»Ö§³Ö text,ntextÀàÐÍ×ֶεÄÌæ»»£¬¿ÉÒÔͨ¹ýÏÂÃæµÄÓï¾äÀ´ÊµÏÖ£º
update tableName set recordName=replace(cast(recordName as varchar(8000)) ,'abc','ddd')
ͨ¹ý cast º¯Êý°Ñtext×ֶεÄÄÚÈÝת»»ÎªvarcharÀàÐÍÔÙ½øÐÐÌæ»»
Ïà¹ØÎĵµ£º
2±êʶ·û¹æÔò
µ±Ê¹Óñêʶ·û¶¨Òå±äÁ¿ ³£Á¿Ê±£¬Ã¿ÐÐÖ»ÄܵÚÒ»Ò»¸ö±êʶ·û
µ±Ê¹Óñêʶ·û¶¨Òå±äÁ¿£¬³£Á¿Ê±£¬±êʶ·ûÃû³Æ±ØÐëÒªÒÔ°¢À²®×Ö·û£¨A~Z,a~z£©¿ªÊ¼£¬²¢ÇÒ×î´ó³¤¶ÈΪ30¸ö×Ö·û¡£Èç¹ûÒÔÆäËû×Ö·û¿ªÊ¼£¬ÄÇô±ØÐëҪʹÓÃË«ÒýºÅÒýס¡£
µ±Ê¹Óñêʶ·û¶¨Òå±äÁ¿³£Á¿Ê±£¬±êʶ·ûÃû³ÆÖ»ÄÜʹÓ÷ûºÅA~Z,a~z£¬0~9£¬_,$ºÍ#¡£Èç¹ûÊ¹Ó ......
SQL2005 ·ÖÎå¸ö°æ±¾£¬ÈçÏÂËùÁУ¬
¡¡¡¡1.Enterprise(ÆóÒµ°æ),
2.Development(¿ª·¢°æ),
¡¡¡¡3.Workgroup,(¹¤×÷Ⱥ°æ)
¡¡¡¡4.Standard,(±ê×¼°æ)
¡¡¡¡5.Express.(àÅ£¬¹ÀÇҾͽÐËü¼òÒ×°æ°É)
¡¡¡¡Õ⼸¸ö°æ±¾£¬ÎÒÃǾ¿¾¹Ó¦¸ÃʹÓÃÄÄÒ»°æÄØ﹖
¡¡¡¡ÕâÊÇÐí¶à³õѧSQL2005µÄÈË×î³£ÎʵÄÎ ......
¶ÔÎÊÌâµÄÀí½âÊǽâ¾öÎÊÌâµÄÇ°Ìᣬ½ñÌìÓöµ½Ò»¸öÏîÄ¿ÖеÄÎÊÌâÈÃÎÒÉî¿ÌµÄÌå»áµ½ÕâÒ»µã¡£
Á½¸ö±í£º
T1
Term Domain WithAncestor
car x.com ?
bike y.com ?
car a.x.com ?
T2
Parent Domain
x.com ......
¡¾Ñ§Ï°µãµãµÎµÎ¡¿ ÔںܶàÇé¿öÓë»·¾³ÖУ¬ÎÒÃǶ¼Òª¶ÔÒÑÓеÄÊý¾Ý¿â½øÐб¸·Ý£¬ÕâÑùÒÔ·ÀÖ¹µ±ÎÒÃÇÒòÈËΪ»òÕß·þÎñÆ÷µÈÖî¶àÔÒò¶øµ¼ÖµÄÊý¾Ý¶ªÊ§£¬
´Ó¶ø¸øÎÒÃÇ´øÀ´ºÜ´óµÄÂé·³£¬ÎÒÒ²ÊǽӴ¥SQLû¶à³¤Ê±¼ä£¬¶ÔÓëËüÇ¿´óµÄÊý¾Ý¿É»Ö¸´¹¦ÄÜ Ò²Ö»ÊÇÂÔÖªÒ»¶þ£¬µ±È»ÔÚÕâÀïÒ²Ö»ÊÇ×ö¶ÔËü×öÂÔÂԵļǼ£¬
´¿´âÊÇ ......
bit ÕûÐÍ bit Êý¾ÝÀàÐÍÊÇÕûÐÍ£¬ÆäÖµÖ»ÄÜÊÇ0¡¢1»ò¿ÕÖµ¡£ÕâÖÖÊý¾ÝÀàÐÍÓÃÓÚ´æ´¢Ö»ÓÐÁ½ÖÖ¿ÉÄÜÖµµÄÊý¾Ý£¬ÈçYes »òNo¡¢True »òFa lse ¡¢On »òOff int ÕûÐÍ int Êý¾ÝÀàÐÍ¿ÉÒÔ´æ´¢´Ó- 231(-2147483648)µ½231 (2147483 647)Ö®¼äµÄÕûÊý¡£´æ´¢µ½Êý¾Ý¿âµÄ¼¸ºõËùÓÐÊýÖµÐ͵ÄÊý¾Ý¶¼¿ÉÒÔÓÃÕâÖÖÊý¾ ......