I want to move a table into a specific Schema using T-SQL? I am using SQL Server 2008.
This question is related to
sql-server
sql-server-2008
tsql
schema
sql-server-2016
Short answer:
ALTER SCHEMA new_schema TRANSFER old_schema.table_name
I can confirm that the data in the table remains intact, which is probably quite important :)
Long answer as per MSDN docs,
ALTER SCHEMA schema_name
TRANSFER [ Object | Type | XML Schema Collection ] securable_name [;]
If it's a table (or anything besides a Type or XML Schema collection), you can leave out the word Object since that's the default.
Source: Stackoverflow.com