childrenfirst
Technical User
Hi,
I have a query and it works, but I am trying to pass a variable to the query and failed at this point.
Original query (and worked!):
SELECT Top 5 counter
FROM Employee
ORDER BY NewID()
Try To (and did not work...):
DECLARE @selectnumber AS int
SELECT Top @selectnumber counter
FROM Employee
ORDER BY NewID()
Any advice will be greatly appreciated!!
I have a query and it works, but I am trying to pass a variable to the query and failed at this point.
Original query (and worked!):
SELECT Top 5 counter
FROM Employee
ORDER BY NewID()
Try To (and did not work...):
DECLARE @selectnumber AS int
SELECT Top @selectnumber counter
FROM Employee
ORDER BY NewID()
Any advice will be greatly appreciated!!