• Hi,

    Please also consider using the XML datatype instead of XmlDocuments - it is much easier to work with and faster!

    Here is your select reworked to use an XMl datatype.

    Also, please note that XML is case-sensitive and so specifying "Email" instead of "EMail" will not work.

    Try this out and see if it is easier to work with:

    DECLARE @XML xml;

    SET @XML = N'<ROOT>

    <Customer CustomerID="1" FirstName="John" LastName="Doe" Street="123 Fake Street" City="Anytown" State="NY"

    Zip="11280" HomePhone="555-123-4567" WorkPhone="555-456-7890" MobilePhone="555-111-2345" EMail="jDoe@someweb.com">

    <Accounts>

    <Saving ID="100000" Balance="548.25" Active="1">

    <Transactions>

    <Transaction ID="1" Type="Initial Deposit" Date="4/01/2009" Amount="500.00" NewBalance="500.00" />

    <Transaction ID="5" Type="Deposit" Date="4/01/2009" Amount="50.00" NewBalance="550.00" />

    <Transaction ID="9" Type="Withdraw" Date="4/01/2009" Amount="1.75" NewBalance="548.25" />

    </Transactions>

    </Saving>

    <Checking ID="100001" Balance="650.00" Active="1" OverdraftAccount="100000">

    <Transactions>

    <Transaction ID="4" Type="Initial Deposit" Date="4/01/2009" Amount="450.00" NewBalance="450.00" />

    <Transaction ID="6" Type="Deposit" Date="4/01/2009" Amount="50.00" NewBalance="500.00" />

    <Transaction ID="44" Type="Deposit" Date="4/01/2009" Amount="150.00" NewBalance="650.00" />

    </Transactions>

    </Checking>

    </Accounts>

    </Customer>

    </ROOT>'

    SELECT

    customer.value ('@CustomerID', 'int') AS CustomerID,

    customer.value ('@FirstName', 'nvarchar(20)') AS CustomerFirstName,

    customer.value ('@LastName', 'nvarchar(30)') AS CustomerLastName,

    customer.value ('@Street', 'nvarchar(50)') AS Street,

    customer.value ('@City', 'nvarchar(20)') AS City,

    customer.value ('@State', 'nchar(2)') AS [State],

    customer.value ('@Zip', 'nchar(10)') AS ZipCode,

    customer.value ('@EMail', 'nvarchar(30)') AS Email,

    customer.value ('@HomePhone', 'nchar(12)') AS HomePhone,

    customer.value ('@WorkPhone', 'nchar(12)') AS WorkPhone,

    customer.value ('@MobilePhone', 'nchar(12)') AS CellPhone

    FROM

    @XML.nodes ('/ROOT/Customer') AS x (customer)

    MM



    select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);

  • Forum Etiquette: How to post Reporting Services problems
  • [/url]
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • [/url]
  • How to Post Performance Problems - by Gail Shaw
  • [/url]