Change database schema name using mssql
Question :
============================================
I have this schema : [hhh].[spemployee]
and what to change schema like this : [eee].[spemployee]
============================================
Answer :
=============================================
First Create below
IF (NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'eee'))
BEGIN
EXEC ('CREATE SCHEMA [eee] AUTHORIZATION [dbo]')
END
Then user ALTER to change schema name
ALTER SCHEMA [eee]
TRANSFER [hhh].[spemployee]
=============================================
=====================================================
and Result as below :
[eee].[spemployee]
=====================================================
ALTER SCHEMA [eee]
TRANSFER [hhh].[spemployee]
=============================================
=====================================================
and Result as below :
[eee].[spemployee]
=====================================================
Comments
Post a Comment