• JPJ (8/19/2008)


    I agree with you wayne.

    I have a small issue in addition to that, this line gave me error:

    select @MyXMLString = @MyXMLString +

    ' '+ AccountNumber +

    ' '

    This is the error:

    Msg 102, Level 15, State 1, Line 6

    Incorrect syntax near 'AccountNumber'.

    Any idea?

    (I do wish that this site's forum board would support the display of XML tags easier!)

    For that select command, there are two extraneous quote marks. The first is on the second line, after the "Row" xml tag immediately prior to the "AccountNumber" tag. The second is on the third line, immediately after the backslash character and immediately prior to the "AccountNumber" tag.

    So, it should look like:

    select @MyXMLString = @MyXMLString +

    '<Row><AccountNumber>'+ AccountNumber +

    '</AccountNumber></Row>'

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2