Monday, November 6, 2023

Select stored procedure- select query to XML

 ALTER PROCEDURE [dbo].[SSP_AllState] --1  

  

  

AS   

BEGIN  

SELECT CAST((SELECT [StateId]  

      ,[StateName]  

      ,[StateNameInLocal]  

      ,[StateCode]  

      ,[IsActive]  

      ,[CreatedBy]  

      ,[CreatedDate]  

      ,[UpdatedBy]  

      ,[UpdatedDate]  


      ,[IPAddress]  

   from [State] with(nolock) where IsActive=1  

   order by [StateName]  

  FOR XML RAW('StatesList'),ELEMENTS,ROOT('States')) AS XML)  

  END

No comments:

Post a Comment