Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
how can I place apostrophe around texts?i.e.declare @values varchar(100)set @values = 'EUR, USD, GBP'I would like them to be:set @values = 'EUR', 'USD', 'GBP'Thanks
May be I should have elaborated further.the @values can vary...Let's say @values = 'EUR, GBP, JPY'I would like to see:@values to be ('EUR', 'GBP', 'JPY')Thanks
arkiboys
Master Smack Fu Yak Hacker
1433 Posts
Posted - 2012-01-17 : 12:25:18
How about this:declare @values varchar(1000) set @values = 'USD, GBP, JPY' set @values = '(' + replace(@values, ', ', ''', ''') + ')' set @values = replace(@values, '(', '(''') set @values = replace(@values, ')', ''')') print @values