• yungmunk (3/2/2015)


    Hello, I'm sorry to resurrect such an old post but I'm trying to do basically the same thing the original poster was. Your code looks very simple and easy to use but I'm not sure how an UPDATE would fit in to this. Could you provide an example?

    Assuming you are trying to do the same as the OP just add the string literal I posted at the beginning of the sql variable.

    You might also want to take a look at this article to generate the comma separated list of columns. http://www.sqlservercentral.com/articles/comma+separated+list/71700/[/url]

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/