Smart Rename false positive in INSTEAD OF INSERT trigger

geophphriegeophphrie Posts: 7
edited June 18, 2009 3:17PM in SQL Refactor Previous Versions
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 :-)

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.

Comments

  • Eddie DEddie D Posts: 1,733 Rose Gold 5
    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 [email protected]. Please place the following call reference number into the subject field of the e-mail, F0023399.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: [email protected]
Sign In or Register to comment.