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

Unable to perform operation on the item is locked in workspace

Insecure cookie setting: missing Secure flag

Display Canvasjs Line Chart using Data from Database