Monday, August 29, 2011

How to retriev table data in xml format?

We can retriev table data in xml format by using For xml 4 different modes.
Please see the below examples for reference.



Output of the above script




Output of the above script

Output of the above script



How to read attributes of a xml type?



How to Parse XML data using XML type?

We can parse xml data by using .query() method or by .value() method.
XML type is having 2 more methods
1.nodes()->This method will return each node of xml file.
2.exist()->This method is quite similar to IF Exists method of sql server.




What is XML Type in SqlServer?

Xml Type is new datatype introduced in Sqlserver 2005 and SQlserver 2008.
Before Xml type, text type was used for storing Xml data but there was limitation of xml size.
XMl Type: Now new xml type can hold xml file upto 2GB.


Tuesday, August 9, 2011

What is Difference Between Out and Ref keyword in C#?


Out & Ref keywords in C# are used for returning multiple values from a function.


Difference:


Out parameter need to be initialized inside the body of a method but not in the case of ref parameter.


Example of Out Keyword



Example of Ref Keyword


Example of Out & Ref Keyword