Working with Xml formats in sql server 2005











XML Auto







Query:
SELECT * FROM dbo.Receipes_Master
FOR XML AUTO, TYPE







Results: Results will be as shown figure right side



Inferences:



1)For each Id column one element will be returned



2) Each element will have table name as element name and columns attributes to that element



3) It will have multiple root elements






XML Path



Query :




SELECT Receipe_Id as "RecipeId",
Title,
Description,
Ingredients,
Instructions,
Garnish,
Glassware,
Is_feature
FROM Receipes_Master
FOR XML PATH('Receipe_Id')






Results



Popular Posts