Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello,
I am using simple update query.

SQL
update tmOredr set RequiredVectorFormatTypeID = null
where  IsEmbroideryOrder =0 and RequiredVectorFormatTypeID=7


But it is giving me this error.
XML
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.


I dont understand where is subquery? Please help.

Thanks

Reason for update
Sorry i was trying self join so i post it wrongly. Actually I have used where clause
Posted
Updated 12-Jul-12 23:28pm
v4

Should you not be using the where operator?

SQL
update tmOredr set RequiredVectorFormatTypeID = null
WHERE  IsEmbroideryOrder =0 and RequiredVectorFormatTypeID=7
 
Share this answer
 
v2
Comments
Manas Bhardwaj 13-Jul-12 5:23am    
Ditto. I should be typing fast. :) +5
Abhinav S 13-Jul-12 5:25am    
Thanks Manas. :)
pradiprenushe 13-Jul-12 5:31am    
Sorry for wrong typing. Actually I have used where clause. I have updated question. Please Check it.
Abhinav S 13-Jul-12 6:28am    
There is a race condition as you are trying to set values to the same column you are doing a where clause on.



Try something like this
(though Im not sure if it will work).

update a set a.RequiredVectorFormatTypeID = null
FROM tmOredr a
INNER JOIN tmOredr b ON a.RequiredVectorFormatTypeID = b.RequiredVectorFormatTypeID
WHERE b.IsEmbroideryOrder =0 and b.RequiredVectorFormatTypeID=7
Prasad_Kulkarni 16-Jul-12 23:58pm    
My 5!
I don't think this is valid syntax:

SQL
UPDATE
    tmOredr
SET
    RequiredVectorFormatTypeID = null
WHERE
    IsEmbroideryOrder = 0
    AND RequiredVectorFormatTypeID = 7
 
Share this answer
 
Comments
Abhinav S 13-Jul-12 5:25am    
Correct. 5. :)
Prasad_Kulkarni 16-Jul-12 23:58pm    
My 5!
SQL
update tmOredr set RequiredVectorFormatTypeID = null
Where IsEmbroideryOrder =0 and RequiredVectorFormatTypeID=7
 
Share this answer
 
Comments
Abhinav S 13-Jul-12 5:25am    
Correct. 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900