Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
KnooKie
Aged Yak Warrior
623 Posts |
Posted - 2001-06-14 : 11:53:42
|
Dynamic SQL or How do I SELECT TOP @var records?Link http://www.sqlteam.com/item.asp?ItemID=233I was wondering if there was an error in this article and in particular the piece of code below:declare @vSQL varchar(1000), @numrows intselect @numrows = 25select @v1 = 'select top ' + convert(varchar, @numrows) + ' * from MyTable Order by DateColumn'Execute (@v1)Should the declare variable be called @v1Just thought i'd mention itEdited by - KnooKie on 06/14/2001 11:56:18 |
|
|
|
|