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 |
|
xpandre
Posting Yak Master
212 Posts |
Posted - 2003-11-24 : 03:51:26
|
| hi,this is my queryselect top 1 * from (select top @num * from emptest order by sal desc) b order by sal asc it gives Line 3: Incorrect syntax near '@num'.can any one pls correct this query..thank you |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2003-11-24 : 04:06:20
|
| declare @sql nvarchar(500)declare @num intset @sql='select top 1 * from (select top'+convert(varchar(10), @num)+' * from emptest order by sal desc) b order by sal asc' exec sp_executesql @sqlThe Judgement of the Judge is as good as the Judge. |
 |
|
|
xpandre
Posting Yak Master
212 Posts |
Posted - 2003-11-24 : 04:18:57
|
thanks harshal.. |
 |
|
|
|
|
|