my result set becomes Empty?

  • USE AdventureWorks;

    GO

    SELECT ProductID, Name, Color

    FROM Production.Product

    WHERE ProductID = 1000

    FOR XML RAW('Task'), root('TaskList')

    How can i achieve this below result set if my result set becomes Empty in XML Datatype.

    Appreciate Your HELP!!!

  • Have you made sure this productID exists? The adventureWorks database I have installed does not have this productID.

  • Matt Wilhoite (8/13/2009)


    Have you made sure this productID exists? The adventureWorks database I have installed does not have this productID.

    Yes, the same ProductID not in my database as well.

    But if the same ProductID is not in the database table my expected result set should be shown (). Is it possible here?

  • I guess I am unclear on what your expected result set is.

  • USE AdventureWorks;

    GO

    SELECT ProductID, Name, Color

    FROM Production.Product

    WHERE ProductID = 1

    FOR XML RAW('Task'), root('TaskList')

    If executing the above query, XML result set will come along this ProductID 1.

    USE AdventureWorks;

    GO

    SELECT ProductID, Name, Color

    FROM Production.Product

    WHERE ProductID = 1000

    FOR XML RAW('Task'), root('TaskList')

    If i execute the above one i will get an empty result set. I want this XML ("") instead of Empty.

    How can i achieve this?

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply