Sql Concatenates Row Wise Data in sql Server

Jayakumars
Posted by Jayakumars under Sql Server category on | Points: 40 | Views : 1130
hi

DECLARE @Year varchar(max)
SET @Year = (SELECT cast(year AS VARCHAR(MAX)) + '-' from T7 for XML PATH(''))
SET @Year = substring(@Year,1,len(@Year)-1)
select @Year as Year, empname,sum(amt)as Amount from t7 group BY empname

Comments or Responses

Login to post response