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.
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
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. Then it thows this error any place that references the Moved object before the Alter Schema statement: I take it this is a bug?
Thanks,
Chris