日期:2014-05-17 浏览次数:20541 次
DECLARE @TargetValue VARCHAR(100) set @TargetValue='310000Fa001,310000Fe001' SELECT @TargetValue SET @TargetValue = '"''310000Fa001","''310000Fe001"' --注意单引号的转义 SELECT @TargetValue --"'310000Fa001","'310000Fe001"
------解决方案--------------------
select '''310000Fa001'''+','+'''310000Fe001''' --'310000Fa001','310000Fe001'
------解决方案--------------------
declare @TargetValue varchar(100)
set @TargetValue='310000Fa001,310000Fe001'
select ''''''+replace(@TargetValue,',',''''',''''')+''''''
--''310000Fa001'',''310000Fe001''
select ''''''''+replace(@TargetValue,',',''''',''''')+''''''''
--'''310000Fa001'',''310000Fe001'''
------解决方案--------------------
--你是这意思么?
set @TargetValue = ''''+ REPLACE(@TargetValue,',',''',''')+''''
------解决方案--------------------