Can anyone tell me why I cannot create a procedure with the following code in SQL Server 2000? For example I can run this in SQL Query Analyzer and it works:
WHILE (SELECT count(*) FROM testtable) > 0
However whenever I add the line CREATE PROCEDURE TEST to create a procedure from the working code above it always fails with error 'Incorrect syntax near the keyword 'WHILE'.
CREATE PROCEDURE TEST WHILE (SELECT count(*) FROM testtable) > 0
Server: Msg 156, Level 15, State 1, Procedure test, Line 2
Thanks in advance.
You need an AS..
answered Nov 25, 2009 at 08:40 AM
The logic does not seem to good without WHERE clause. If there is no where clause you can simply use
answered Nov 25, 2009 at 09:39 AM