@s='S1,S2,S12,S23';
½«@sÀïÃæµÄS1,S2Ìæ»»³É´¦Àí£¬Î´´¦Àí
À´ÕßÓзÖ.
REPLACE(@s,'S1,S2','´¦Àí,δ´¦Àí')
REPLACE ²»ºÃÓà ×Ô¼ºÊÔÏÂ
SQL code:
declare @s varchar(200)
set @s='S1,S2,S12,S23'
select replace(@s,'S1,S2','´¦Àí,δ´¦Àí')
´ó¼ÒÕâÑùÊÔÏÂ
@s='S1,S12,S2,S23';
½«@sÀïÃæµÄS1,S2Ìæ»»³É´¦Àí£¬Î´´¦Àí
SQL code:
declare @s varchar(200)
set @s='S1,S12,S2,S23'
set @s = ',' + @s +','
set @s = replace(@s, ',S1,',',´¦Àí,')
set @s = replace(@s, ',S2,',',δ´¦Àí,')
select substring(@s, 2, len(@s) - 2)
/*
´¦Àí,S12,δ´¦Àí,S23
*/
SQL code:
DECLARE @s varchar(MAX);
SET @s = 'S1,S12,S2,S23,S1';
SELECT @s = REPLACE(REPLACE(','+@s+',',',S1,',',´¦Àí,'),',S2,',',δ´¦Àí,')
SELECT STUFF(LEFT(@s,LEN(@s)-1),1,1,'')
SQL code:
declare @s varchar(200)
set @s='S1,S12,S2,S23'
set @s = ',' + @s +','
set @s = replace(replace(@s, ',S1,',',´¦Àí,'),',S2,',',δ´¦Àí,')
select su
¿ÉÄÜÒòΪ¹¤×÷µÄÔÒò ½Ó´¥Êý¾Ý¿âÕâ¿é±È½ÏÉÙ£¬Ö®Ç°¶¼ÊÇ×ö³ÌÐòÕâ¿é£¬Êý¾Ý¿âÕâ¿é¶¼ÓÐרÃŵÄÈËÀ´×ö ·Ö¹¤¶¼ºÜÃ÷ϸ ËùÒÔ¶ÔÊý¾Ý¿âÕâÒ»¿éÍêÈ«²»Á˽⡣ǰ¶Îʱ¼ä È¥ÃæÊÔÁ˼¸¼Ò¹«Ë¾ ¼¸ºõ¶¼ÊÇÔÚÊý¾Ý¿âÕâ¿é¹ÒµôµÄ Á¬¸ö¼òµ¥µÄSQ ......