Guest_imported
New member
- Jan 1, 1970
- 0
I have a query n Access97 that I need to convert to SQL Server as a stored procedure, it looks like this:
CREATE PROCEDURE TopAlRecs @recs VARCHAR(50) AS
SELECT TOP @recs *
FROM AlarmPage
ORDER BY AlarmPageID DESC;
But when I try to "run" this stored procedure in Query Analyser I get the following error:
Incorrect syntax near '@recs'
If I put in a number like:
SELECT TOP 3 *
then it works fine. But I need to have different numbers there everytime so I need to send a parameter @rec. How can I solve this problem?
I hope someone can help me!
regards, Bob
CREATE PROCEDURE TopAlRecs @recs VARCHAR(50) AS
SELECT TOP @recs *
FROM AlarmPage
ORDER BY AlarmPageID DESC;
But when I try to "run" this stored procedure in Query Analyser I get the following error:
Incorrect syntax near '@recs'
If I put in a number like:
SELECT TOP 3 *
then it works fine. But I need to have different numbers there everytime so I need to send a parameter @rec. How can I solve this problem?
I hope someone can help me!
regards, Bob