Nullqwerty
Nullqwerty

Reputation: 1168

Error While Trying To Insert A SQL Azure Database Table Record

I had a table called 'MyTestTable' in my SQL Azure database. Using the SQL Azure user interface on it's web page, I renamed the table to 'MyTestTables'. Now when I run an insert into the table I get the error:

Msg 208, Level 16, State 1, Procedure TR_MyTestTable_InsertUpdateDelete, Line 8
Invalid object name 'MyDb.MyTestTable'.

So, it appears that there's an underlying system stored proc (edit: looks like it's actually a trigger) that gets fired during inserts, and the user interface didn't update this stored proc with the new table name. I tried dropping the table and re-adding it, but the error remains. After re-adding it, it actually automatically picked up all of the columns the table originally contained, so dropping the table must still keep a reference to it, which gets reused if you re-add it, which is probably why my error is still there.

I can't find this procedure anywhere to modify it. What can I do to fix this other than creating a new table with a different name?

Upvotes: 1

Views: 146

Answers (1)

Nullqwerty
Nullqwerty

Reputation: 1168

Figured out a way.

exec  sp_helptext N'MyDB.TR_MyTestTable_InsertUpdateDelete'

Gives me the definition. It's in a format though that can't be copied and pasted. So I retyped it all and updated the table name and changed it to an alter trigger. All is good now.

Thanks

Upvotes: 1

Related Questions