Reputation:
Probably a dumb question.
When I run the query
DELETE FROM "ITEM"
WHERE "COUNIDAD" = '130' AND "COINGRES" = 1 AND "ITEM" = '0002' AND "COCAJA" = '001'
It returns the error
Conversion failed when converting the nvarchar value '130|' to data type smallint.
But the is no '130|' in my query as you can see.
What is happening?
Edit:
COUNIDAD nvarchar(3), COINGRES smallint, ITEM nvarchar (5), COCAJA nvarchar(3)
just in case
Edit 2:
Is specially weird since the query:
SELECT * FROM "ITEM"
WHERE "COUNIDAD" = '130' AND "COINGRES" = 1 AND "ITEM" = '0002' AND "COCAJA" = '001'
Returns the row I want to delete
Edit 3:
Update doesn't work either :/
Upvotes: 1
Views: 435
Reputation:
As @Jason Whitish mention, there was 2 triggers already created in the database (I didn't know pls no hate :S). I deleted them and the process worked.
Thank you guys!
Upvotes: 1
Reputation: 1270993
Based on your query logic, this could only occur if COINGRES
were really a string. You can fix the problem by having the comparison be a string:
DELETE FROM "ITEM"
WHERE "COUNIDAD" = '130' AND "COINGRES" = '1' AND "ITEM" = '0002' AND "COCAJA" = '001';
Upvotes: 0