Viewing 3 posts - 1 through 3 (of 3 total)
Try this. I have assumed that birthdate is stored as datetime. If it is a varchar, then be careful to check for differences in regional dates ( 1/2/1989 and 2/1/1989...
December 9, 2005 at 9:05 am
#608703
Jules,
I had a similar problem and dealt with it using the code below. If there is a better way to do it though I would also be interested to see...
December 2, 2005 at 5:25 am
#607301
try this
declare @sqlstring nvarchar(4000)
set @sqlstring = 'select top ' + cast(@topnproduct as varchar) + ' * from table'
exec(@sqlstring)
November 2, 2005 at 10:00 am
#601912