Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Getting error in SQL Server when i am trying to delete a row. the column which it is complaining already exists...

DELETE
from [dbo].[sample]
WHERE [pk_sample] = '642388'


(1 row affected)

(1 row affected)

(1 row affected)

(1 row affected)
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SampleCondition'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SampleCondition'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SampleCondition'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SampleCondition'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SampleCondition'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SampleCondition'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SampleCondition'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'SampleCondition'.

What I have tried:

I have tried checking the column if it exists and what value it has.. it has a Null value passed into it...
Posted
Updated 9-Mar-19 0:44am

1 solution

I'd start by looking at the code you are using to execute that SQL, and any TRIGGERS you have set in the DB: the number of messages you have would indicate that you are doing it in a loop or similar, and it's probably the code around that SQL that is causing the problem - just issuing that command as it stands will give you one single "N rows affected" unless you have a TRIGGER on the delete which is trying to do a load of other things and that TRIGGER code has a problem.
 
Share this answer
 

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