Reputation: 39055
declare @tachareName varchar(200)
,@a varchar
set @tachareName='fsfhk,fsif,'
if(CHARINDEX(',',@tachareName)!=0)
--print @tachareName
--select REPLACE(@tachareName,',',' ')--The output is:fsfhk fsif
set @a=REPLACE(@tachareName,',',' ')
--REPLACE(@tachareName,',',' ')
print @a --The output is:f
What's wrong,i want to judge if the string has ',' symbal and repalce it with ' '.
The envirioment is SQL Server 2008.
Upvotes: 1
Views: 35