Monday, March 19, 2012

Msg 512 on cursor

Everytime I execute this procedure it gives a msg 512 subquery returns more then one value. Can someone just explain why or what I'm doing wrong? Thanks in advance

Here is my code:

create procedure insert_sku_info
AS
Declare
@.method varchar(40),
@.sku int,
@.location varchar(40)

Declare insert_cur Cursor For
select a.method, s.sku, s.location
from archive_sku a INNER JOIN sku s on a.sku = s.sku
and a.location = s.location

Open insert_cur

Fetch Next from insert_cur
Into @.method, @.sku, @.location

While (@.@.Fetch_Status = 0)
Begin

print @.method + @.sku + @.location

Update sku
set method = @.method
where sku = @.sku
and location = @.location

Fetch Next from insert_cur
Into @.method, @.sku, @.location

End
close insert_cur
deallocate insert_curNever mind I figured it out.

That print statement I had listing all the variables was the problem.

Thanks anyway.

No comments:

Post a Comment