Question: What is schema in SQL Server? How can we create schema in SQL Server?
Answer: Schema introduced in SQL Server 2005 which is used for separation, Management and Ownership of database object. Schema is distinct namespace which is used to store database object. It is remove the tight coupling if database objects and owners to improve the security administration of database objects.
Create schema using wizard
Create schema using query
USE[Test]
GO
--Create Schema MySchema
CREATESCHEMA[MySchema]AUTHORIZATION[dilip]--dilip is the owner (database user)
GO
Question: How to change schema of table in SQL Server?
Answer: Suppose we have a table Codefari which have default schema [dbo] and we have to transfer it in schema [blog], following query may help you.
CREATESCHEMABlog
GO
ALTERSCHEMABlog
TRANSFERdbo.Codefari
GO
Question: How to drop schema in SQL Server?
Answer: If we have permission then using following query we can drop schema.
DROPSchemaBlog