declare @vSQL varchar(1000)
declare @n int
set @n=5
set @vSQL='select Top 1 EmpSalary From
(Select Distinct Top ' + convert(varchar, @n) + ' EmpSalary
from EmpsInfo order by EmpSalary desc) a
order by EmpSalary'
exec(@vSQL)
declare @retstr varchar(8000)
select @retstr = COALESCE(@retstr + ',','') + cast(memno as varchar) from sample where sno=1
print @retstr
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment