sql server - How to concatenate a column value with single quotes in sql? -


how concatenate column value single quotes , comma in sql?

select tpaa_id  dbo.sheet tpaa_id not null 

at present query returns, value ..

abc123 abc456 

we have around 1000 records.

i expect return

'abc123', 'abc456', 

you can use variable concatenation:

declare @result nvarchar(max)  select @result  = isnull(@result + ', ', '') + '''' + tpaa_id  + ''''  dbo.sheet tpaa_id not null  select @result 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -