I am not a SQL guy. But while working on something I found this which seemed cool to me. So thought of sharing it with folks in case you are not aware. Using SQL Management studio and running T-SQL command we can export the Database table entries into an XML form.
Let's say you run this SQL command in the SQL editor.
SELECT * from Saurabh.dbo.Customers
And we get the following output in the table.
Now in order to export the table content into an XML form we need to use FOR XML PATH as below:
FOR XML AUTO
FOR XML RAW
FOR XML PATH
FOR XML PATH('Customer')
If you want to wrap the content under a specific ROOT node use the following:
It may not be something new for the SQL folks but this was something new to me.
till next time….
can you help me in creating dynamic menu from my sql database using xml and mvc