Click here to Skip to main content
15,911,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all

When ever i am running the below query:

delete from email_data where exp_date < getdate()
I am getting the below error:

Msg 208, Level 16, State 1, Procedure trgInsteadOfDelete, Line 9
Invalid object name 'email_test'

Please tell me whats the error
Posted
Comments
Santhosh Kumar Jayaraman 16-Aug-12 3:32am    
post ur trigger here
[no name] 16-Aug-12 3:37am    
there is no sp or trigger...its a one line delete command..

based on your question: You get an error saying that the table 'email_test' does not exist but you state that you try to delete from email_data

So re-check the statement you're executing against the database just before it's executed in the code. Is the SQL string you're using changing somewhere or does it contain a typo.
 
Share this answer
 
Comments
[no name] 16-Aug-12 3:20am    
email_test id the database and email_data is the table.
Wendelius 16-Aug-12 3:24am    
Ok, so the table is qualified in the delete statement so somethng like:

delete from email_test.email_data

If that's the case, does the user have permissions to access and delete from that table in that database?
[no name] 16-Aug-12 3:36am    
yes permissions are there..actully the error giving at "trgInsteadOfDelete" stored procedure but there is no stored procedure with such name..
Wendelius 16-Aug-12 3:38am    
Based on the name it's probably not a procedure but a trigger. So using for example SSMS, check the triggers of the email_data table.
[no name] 16-Aug-12 3:40am    
but there is no trigger in the database...i don't know why it is giving such error...
You need to look at your stored procedure "trgInsteadOfDelete" at line 9 - the problem is that the procedure is being called by a trigger when a delete occurs, and it is probably looking at the wrong table.
 
Share this answer
 
Comments
[no name] 16-Aug-12 2:57am    
But i don't have any such stored procedure in my DB
OriginalGriff 16-Aug-12 3:34am    
Check under "Database Triggers" in the "Programmability" section with SSMS - I bet you do! :laugh:

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