i have variable in sql server like
DECLARE @Country varchar(max)
SET @Country='GB,US'
here country name is stored and separated by comma. i want to change and store the value in Country variable like ''GB','US','DE','FR''.
so i was trying by using stuff function like
DECLARE @Country varchar(max)
SET @Country='GB,US'
SELECT @Country=STUFF((SELECT ''', ''' + @Country
FOR XML PATH ('')),
1, 2, '')
print @Country
so please me to achieve it. if i could store country name like ''GB','US','DE','FR'' this way into country variable then i can issue a query like
select * from my table where country in ( @Country)
please help thanks