Merge Multiple Rows into a Single Row in SQL Server

      In Some times Need Multiple Rows into single row and combine column SQL.

   this is My Table Studenttbl I Shown All RollNo And I Merge to Single Row. for Use Following SQL Query.  


declare @Roll as varchar(max)=''
select @Roll= substring(
        (select ' ,'+RollNo AS 'data()' from tbl_Studentdtl for xml path(''))
       ,3, 255)

          select @Roll RoleNo



Comments

Popular posts from this blog

Insecure cookie setting: missing Secure flag

Maximum Stored Procedure Function Trigger or View Nesting Level Exceeded (limit 32) in SQL Server

Display Line Chart Using Chart.js MVC C#