Click here to Skip to main content
14,028,764 members
Rate this:
 
Please Sign up or sign in to vote.
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
   

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190419.4 | Last Updated 9 Mar 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100