Rajesh
Wednesday, February 1, 2012
SQL concate top N rows of a column
declare @emp varchar(max)
SET @emp=''
select top(4) @emp=@emp+ cast(empid as varchar) + ',' from employees
select @emp
select SUBSTRING(@emp,0,len(@emp)-1)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment