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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 stored proc

Author  Topic 

mixalis
Starting Member

8 Posts

Posted - 2008-06-16 : 13:52:05
2> create procedure getrecords @number integer as insert into target select top(
@number) * from source where status = 0 update top(@number) source set status =
1 where status = 0;
3> go
Msg 111, Level 15, State 1, Server MIXALIS-4DD26DE, Procedure getrecords, Line 2

'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
Hi all,

with the above I am trying to SELECT some records from source INSERT them into target and then UPDATE source by setting status = 0 for those records that I have selected...

I get Msg 111... any ideas???

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-16 : 14:01:46
You have some other statements prceding create proc. as error message says it should be first statement in batch. can you remove statements before create procedure or put a GO before create procedure statement?
Go to Top of Page
   

- Advertisement -