Moving/Renaming a Table to a new Schema not working
sburrows
Posts: 5 Bronze 1
in SQL Compare
I used the File Mapping to rename a table from "misc.Audit" to "audit.General_Audit"
The SQL created was thus:
IF (OBJECT_ID(N'[misc].[Audit]', 'U') IS NOT NULL) AND (OBJECT_ID(N'[audit].[General_Audit]', 'U') IS NULL)
EXEC sp_rename N'[misc].[Audit]', N'General_Audit', N'OBJECT'
GO
IF (OBJECT_ID(N'[misc].[Audit]', 'U') IS NOT NULL) AND (OBJECT_ID(N'[audit].[General_Audit]', 'U') IS NULL)
ALTER SCHEMA [audit] TRANSFER [misc].[General_Audit]
#2 will not execute as misc.Audit has been renamed in #1
After a successful running of the script, I have a table
misc.General_Audit
The SQL created was thus:
IF (OBJECT_ID(N'[misc].[Audit]', 'U') IS NOT NULL) AND (OBJECT_ID(N'[audit].[General_Audit]', 'U') IS NULL)
EXEC sp_rename N'[misc].[Audit]', N'General_Audit', N'OBJECT'
GO
IF (OBJECT_ID(N'[misc].[Audit]', 'U') IS NOT NULL) AND (OBJECT_ID(N'[audit].[General_Audit]', 'U') IS NULL)
ALTER SCHEMA [audit] TRANSFER [misc].[General_Audit]
#2 will not execute as misc.Audit has been renamed in #1
After a successful running of the script, I have a table
misc.General_Audit
Tagged:
Comments
Apologies.
Redgate Software
This has been resolved in the latest version of SQL Compare which was released yesterday 12.4.2.4681.
please let me know if after installing this your issue remains.
Dan Bainbridge
Product Support Engineer | Redgate Software