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
 General SQL Server Forums
 New to SQL Server Programming
 Msg 512, Level 16, State 1

Author  Topic 

petercdobbs
Starting Member

3 Posts

Posted - 2009-09-24 : 09:24:46
I must have done a query like this a million times, today i get an error. Please save me before i smash my computer...


UPDATE ProductInventory
SET OnHand = 100, ControlType = 1, countsDown = 0
WHERE (productInvId IN
(SELECT productInventoryId
FROM __temp_xx))

__temp_xx is just a basic table with one column and a distinct list of integers.

productInvId is the primary key for the productInventory Table

I get this error:

Msg 512, Level 16, State 1, Procedure t_PI_Update_Desc_Flag, Line 33
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

AGGGGGGGGGGGGGGGGGGGGGGG!!!!!!

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-24 : 09:26:41
What happens when you do this


UPDATE ProductInventory
SET OnHand = 100, ControlType = 1, countsDown = 0
WHERE productInvId IN
(SELECT productInventoryId
FROM __temp_xx)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

petercdobbs
Starting Member

3 Posts

Posted - 2009-09-24 : 09:36:57
i get this:

Msg 512, Level 16, State 1, Procedure t_PI_Update_Desc_Flag, Line 33
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
Go to Top of Page

mhorseman
Starting Member

44 Posts

Posted - 2009-09-24 : 10:04:37
I see that the error is on Line 33 of your proc. Are you sure that your update statement is the problem?

Mark
Go to Top of Page

petercdobbs
Starting Member

3 Posts

Posted - 2009-09-24 : 10:11:22
it's the trigger.

thanks!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-24 : 10:17:10
quote:
Originally posted by petercdobbs

it's the trigger.

thanks!


Post the trigger code

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -