sqlines
sqlines copied to clipboard
Oracle to MSSQL 2016: Failed to create extended property
I'm trying to migrate an entire Oracle database to SQL Server, and I'm running into several issues. I will log them separately here.
I'm trying to migrate an Oracle table which has a COMMENT on it, like:
COMMENT ON TABLE MyUser.MyTable IS 'This is my comment';
Migrating this table fails when it tries to convert the comment. The error is "Object is invalid. Extended properties are not permitted on 'MyUser.MyTable', or the object does not exist".
The failing SQL that SQLines generated is:
EXECUTE sp_addextendedproperty 'Comment', 'This is my comment', 'user', MyUser, 'table', [MyTable];
The string 'user' in this command is wrong, and should be changed to 'schema' to make it work:
EXECUTE sp_addextendedproperty 'Comment', 'This is my comment', 'schema', MyUser, 'table', [MyTable];
The same error happens with the conversion of comments on columns. This gets rendered as:
EXECUTE sp_addextendedproperty 'Comment', 'This is my comment', 'user', MyUser, 'table', [MyTable], 'column', MyColumn;
Again 'user' should be changed to 'schema' here.