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.
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.
you might consider using a temp table .. just rename the table #syncParam
精彩评论