Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • XML in SQL

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 26
    Comment on it

    XML data type was introduced in SQL Server to work with XML data.


    Type of XML Data


    AUTO


    It generates output with both element and attribute features in combination with a sub query.


    SELECT * from Employees
    FOR XML AUTO; 
    


    EXPLICIT


    It converts the rowset that is result of the query execution, into an XML document.


    SELECT
     1 tag,
     NULL parent,
     EmpID [employee!1!ID],
     EmpName [employee!1!name],
     NULL [order!2!date],
     NULL [department!3!name]
    FROM Employee
    UNION ALL 
    SELECT
     3,
     1,
     EmpID,
     NULL,
     NULL,
     DeptName
    FROM Employee e JOIN Department d
    ON e.DeptID=d.DeptID
    ORDER BY 3, 1
    FOR XML EXPLICIT;
    


    RAW


    It produce a single element or the optionally provided element name for each row in the query result set that is returned by select statement.


     SELECT * from Employees
    FOR XML RAW; 
    
    SQL Server

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: