• rho_pooka (4/7/2014)


    Thanks a ton for the help! Can the answer look different if you wanted to use node navigation? I think that's what I was trying to do the first time, and I really confused myself.

    Thanks again,

    Ben

    DECLARE @X XML

    SET @X = '<root>

    <production.Categories categoryid="1" categoryname="Beverages" description="Soft drinks, coffees, teas, beers, and ales" />

    <production.Categories categoryid="2" categoryname="Condiments" description="Sweet and savory sauces, relishes, spreads, and seasonings" />

    <production.Categories categoryid="3" categoryname="Confections" description="Desserts, candies, and sweet breads" />

    <production.Categories categoryid="4" categoryname="Dairy Products" description="Cheeses" />

    <production.Categories categoryid="5" categoryname="Grains/Cereals" description="Breads, crackers, pasta, and cereal" />

    <production.Categories categoryid="6" categoryname="Meat/Poultry" description="Prepared meats" />

    <production.Categories categoryid="7" categoryname="Produce" description="Dried fruit and bean curd" />

    <production.Categories categoryid="8" categoryname="Seafood" description="Seaweed and fish" />

    <production.Categories categoryid="9" categoryname="Beer" description="Budweiser" />

    <production.Categories categoryid="10" categoryname="Liquor" description="Captain Morgan" />

    </root>'

    SELECT

    RO.CT.value('@categoryid','INT') AS categoryid

    ,RO.CT.value('@categoryname','NVARCHAR(250)') AS categoryname

    ,RO.CT.value('@description','NVARCHAR(2048)') AS description

    FROM @X.nodes('root/production.Categories') AS RO(CT)

    WHERE RO.CT.value('@categoryid','INT') = 9;

    Use the "WHERE" Luke 😎