• There are two issues:

    #1: in line 1 you have [Customer Customer ID="1" ] There seems to be an additional blank after the second "Customer". It should either be Customer_ID or CustomerID. Then the error will be different. It's not that you have a messed up understanding of elements and attributes. It's more an issue of yor sample data: you cannot have an additional level other than nodes -> elements -> attributes. But the sample data does.

    #2: @XMLdocument is of varchar(1000). But the data you want to store in that variable will exceed the limit. Change it to varchar(2000) or nvarchar(2000) or even varchar(1200) and you'll get the expected result.

    I know, this is not obvious based on the error message. But try a simple LEN(<insert the content of @XMLdocument here> ) and you'll notice that it exceeds the limit of varchar(1000).



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]