Red Gate forums :: View topic - Smart Rename false positive in INSTEAD OF INSERT trigger
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Refactor 1
SQL Refactor 1 forum

Smart Rename false positive in INSTEAD OF INSERT trigger

Search in SQL Refactor 1 forum
Post new topic   Reply to topic
Jump to:  
Author Message
geophphrie



Joined: 10 Jun 2009
Posts: 4
Location: Chattanooga TN USA

PostPosted: Wed Jun 17, 2009 5:09 pm    Post subject: Smart Rename false positive in INSTEAD OF INSERT trigger Reply with quote

I was just doing a Smart Rename, renaming column "isactive" to "stati" in tbl_orgz. All dependent views and procs were handled correctly. However, the very last alter generated was an alter trigger on an "instead of insert" trigger on tbl_student: smart rename was wanting to swap out column isactive (which exists) for stati (which doesn't exist) on the SELECT <columns> FROM INSERTED. I have no idea how it thought this was related to my change, since this is a trigger on a different table. The tables are related by a FK, but the trigger itself doesn't involve the table I was changing. I think it would have failed if I had not caught it (since the new column name would not have existed), though actually... it might have completed the ALTER successfully and failed at runtime - this was a live db so I wasn't going to try it Smile

I guess since an INSTEAD OF INSERT trigger could potentially be used to do a multi-table related insert with one insert command, and the table I was changing was involved in an FK insert, Smart Rename though that the isactive column from the INSERTED alias could be the same as the column I was changing - kind of jumping to an incorrect conclusion in this case.
Back to top
View user's profile Send private message Send e-mail
eddie davis



Joined: 14 Jun 2006
Posts: 922
Location: Red Gate Software

PostPosted: Thu Jun 18, 2009 8:17 pm    Post subject: Reply with quote

Thank you for your post into the forum.

What version of SQL Refactor are you using?

Can you please reply with the table creation scripts for the table tbl_orgz and for the tbl_student, including the trigger creation syntax?

If you do not want to make the creation scripts public, can you please send them in an e-mail to support@red-gate.com. Please place the following call reference number into the subject field of the e-mail, F0023399.

Many Thanks
Eddie
_________________
Eddie Davis
Technical Support Engineer
Red Gate Software Ltd
E-mail: support@red-gate.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group