Competition: What’s your favorite Redgate tool? Enter now.

Smart Rename - Schema change error

ptraceyptracey Posts: 3
edited November 25, 2015 5:39AM in SQL Prompt
I am using the smart rename feature. It works fine until I try and change the schema for a table.

It generates code like:
EXEC sp_changeobjectowner N'[dbo].[FRED]',N'NewSchema'

but this always returns:
Database principal or schema 'NewSchema' does not exist in this database
.

The new schema exists, as I previously ran:
EXEC( 'CREATE SCHEMA NewSchema AUTHORIZATION dbo' );
And it appears in a list when I run
"SELECT name FROM sys.schemas"

Comments

  • OK, I have solved the problem. My database was in SQL 2000 compatibility mode. This was intentional, due to some non-ANSI joins, but I had forgotten. I would still have expected this tool to recognise this fact and generate a working script, or at least alert me to this, but, anyway, problem solved.

    P
Sign In or Register to comment.