Creating a comma separated list from a table (XML alternative)

@comma_seperated_list = COALESCE@comma_seperated_list +’,’,”)+field

Advertisements

One Response to “Creating a comma separated list from a table (XML alternative)”

  1. jl45sql Says:

    Another example

    DECLARE @i VARCHAR(MAX)
    SELECT @i=ISNULL(@i+ ‘,’,”) + name FROM sys.tables
    SELECT @i

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: