How can we help you today? How can we help you today?

5.0.1.7 Smart Rename creates incorrect script

Renaming a table that is only used in a trigger that posts updates to a same-named table in another, audit, database generates the change script without reference to the audit database and doesn't recognize the fact that I haven't also renamed the audit database's same-named table (OOPS!). I would have highlighted the missing database qualifier but using the "code" tag stops that...

Old Code:
ALTER TRIGGER [dbo].[trg_t_site_custom_def_AuditTrigger] ON [dbo].[t_site_custom_def]
AFTER DELETE,UPDATE
NOT FOR REPLICATION
AS 
BEGIN
	SET NOCOUNT ON;
	INSERT INTO [xcp_ref_audit].[dbo].[t_site_custom_def] ([custom_id],[custom_site_id],[custom_xml],[update_date],[update_by])
	SELECT [custom_id],[custom_site_id],[custom_xml],[update_date],[update_by] FROM Deleted
END
New Code:
ALTER TRIGGER dbo.trg_t_site_custom_def_AuditTrigger ON dbo.SiteCustom
AFTER DELETE,UPDATE
NOT FOR REPLICATION
AS 
BEGIN
	SET NOCOUNT ON;
	INSERT INTO dbo.SiteCustom ([custom_id],[custom_site_id],[custom_xml],[update_date],[update_by])
	SELECT [custom_id],[custom_site_id],[custom_xml],[update_date],[update_by] FROM Deleted
END
PDinCA
0

Comments

1 comment

  • Paul Stephenson
    Hi PDinCA,

    Thanks for your report. I've logged this in our system as SP-3861.

    Regards,
    Paul
    Paul Stephenson
    0

Add comment

Please sign in to leave a comment.