Bug in Smart Rename handling Precedence?

Provides intelligent code completion for SQL Server editors.

Moderators: Anu Deshpande, Aaron Law, David Priddle

Bug in Smart Rename handling Precedence?

Postby CGLuttrell » Tue Nov 19, 2013 12:23 am

I am seeing an odd behavior in the SMART RENAME that I normally consider to handle precedence correctly.
I was looking at moving a table to a different SCHEMA and this is a small snippit from the middle showing that it is trying to alter objects to refer to the moved table before moving the table.
Code: Select all
other code above this
...
PRINT N'Creating trigger [Security].[trgOrganizationSnapShotInsertUpdate] on [Security].[Organization]'
GO
-- =============================================
-- Author:      Chris Luttrell
-- Create date: Sep 19 2013 10:52:12:340PM
-- Description:   Save all inserts and updates into the SnapShot table.
--
-- mm/dd/yy  Name     Release  Description
-- 09/30/13  CGL      4.4      Added OrganizationHierarchyId to the list of columns
-- =============================================
CREATE TRIGGER Security.trgOrganizationSnapShotInsertUpdate
   ON  Security.Organization
   AFTER INSERT,UPDATE
AS
BEGIN
   -- SET NOCOUNT ON added to prevent extra result sets from
   -- interfering with SELECT statements.
   SET NOCOUNT ON;

   IF UPDATE(LastModifiedDt)
   BEGIN
      INSERT INTO [SnapShot].Organization (PartyId, OrganizationBreakdownStructure, Name, OrganizationHierarchyId, ParentId, SortOrder, CreatedDt, CreatedBy, CreatedAs, LastModifiedDt, LastModifiedBy, LastModifiedAs)
      SELECT  O.PartyId,
              O.OrganizationBreakdownStructure,
              O.Name,
            O.OrganizationHierarchyId,
              O.ParentId,
              O.SortOrder,
              O.CreatedDt,
              O.CreatedBy,
              O.CreatedAs,
              O.LastModifiedDt,
              O.LastModifiedBy,
              O.LastModifiedAs
      FROM INSERTED O
   END
END
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
ALTER SCHEMA [Security] TRANSFER [Contact].[Organization]
GO
... continued code

Then it thows this error any place that references the Moved object before the Alter Schema statement:
Invalid object name 'Security.Organization'.

I take it this is a bug?
Thanks,
Chris
CGLuttrell
 
Posts: 18
Joined: Thu Sep 10, 2009 9:25 pm
Location: Knoxville, TN

Postby Anu Deshpande » Wed Nov 20, 2013 3:11 pm

Thanks for your post.

I have logged a support ticket for you and have emailed you.
Anuradha Deshpande
Product Support
Redgate Software Ltd.
E-mail: support@red-gate.com
Anu Deshpande
 
Posts: 692
Joined: Mon Apr 20, 2009 3:53 pm
Location: Cambridge


Return to SQL Prompt 6

Who is online

Users browsing this forum: David Priddle and 0 guests