views:

64

answers:

1

hello,

I wrote the following stored procedure, in which I use a local variable 'syncParam':

declare @syncParam bit

select isSync into syncParam from MyTable where id=@id
if (@syncParam='True')...
else ...  

return @syncParam

When I executed this stored procedure at the first time it worked, but after that I get the following error: "there is already an object named 'syncParam' in the database".

What did I miss?

Thanks in advance.

+7  A: 

You want

select @syncParam  = isSync from MyTable where id=@id

SELECT INTO will insert records into a new table. Go look, you should have a syncParam table now.

LittleBobbyTables
thank you very much!!!
mayap