Moving a table in SQL from one schema to another is actually very simple, but as it can't be done via Management Studio, remembering the syntax can be a pain.
Logically you think you want to ALTER TABLE to move it to a different schema, but actually you need to ALTER SCHEMA to give it a table.
What you need to do is:
ALTER SCHEMA NewSchemaName TRANSFER OldSchemaName.TableName
Very easy ... although I know I'll forget that again next time I need to do it ... but at least now I know where I can find the right syntax easily!
No comments:
Post a Comment