Home Forums SQL Server 2008 SQL Server Newbies Comma Seperators RE: Comma Seperators
Lynn Pettis
SSC Guru
Points: 442467
More actions
April 14, 2014 at 10:32 am
#1705835
This will work as well:
with SampleData as (
select
StrVal
from
(values ('abc ,'),('cde,xyz,aaa,'),('zzz, yyy ,ttt,'),('qwe'),('asd,fgh'))dt(StrVal)
)
StrVal,
left(StrVal,len(StrVal) - patindex(',%',reverse(StrVal)))
SampleData;