This is my collection of mostly useful SQL server information that helps administer the server. It is mostly aimed at SQL Server 2012 / 2014 / 2016.
Wednesday, September 14, 2016
Script to Check is a Schema Exists and Create New
USE [master]
GO
IF NOT EXISTS(SELECT schema_id FROM sys.schemas where name = 'DBA')
BEGIN DECLARE @SQLcmd NVARCHAR(50) = 'CREATE SCHEMA [DBA] AUTHORIZATION [db_owner]'; EXEC sp_executesql @SQLcmd;
END
No comments:
Post a Comment