Monday, April 8, 2019

SQL Server : Generating xml from Query

Below query will generate xml for employee records

SELECT [EMP_ID]
      ,[FIRST_NAME]
      ,[LAST_NAME]
      ,[DEPARTMENT_ID]
      ,[SALARY]
  FROM [ABCD].[dbo].[Employee]
FOR XML RAW('Employee'), ROOT('Employees'), ELEMENTS XSINIL;

No comments:

Post a Comment

C# Record type: Something to remember while using record types

  Record in c# provide a concise and expressive way to create immutable data types, record is a keyword in c#, we can use this keyword with ...