How to convert this:
('xxx','yyy','zzz')
Into this:
('xxx,yyy,zzz')
Using T-SQL?
DECLARE @x VARCHAR(32) = '''xxx'',''yyy'',''zzz''';
SELECT REPLACE(@x, ''',''', ',');
If all you want to do is concatenate then you can do:
SELECT @param1 + ',' + @param2 + ',' ... + @param30;
However that is just silly IMHO. This is like washing each of your socks separately.
I have to question what you're going to do with the value now... if these are separate entities why are they comma-separated in the first place? Perhaps you should look into table-valued parameters instead of this comma-separated values nonsense, then you can use the values in a set-based way right from the start.
by concatenating the values ( which means individual columns )?
SELECT (col1 + ',' + col2+ ',' + col3)
FROM tableName
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.