Skip to content

Instantly share code, notes, and snippets.

@UstDoesTech
Created February 22, 2022 08:37
Show Gist options
  • Save UstDoesTech/0d3164c974d898be6773b8210b4145ec to your computer and use it in GitHub Desktop.
Save UstDoesTech/0d3164c974d898be6773b8210b4145ec to your computer and use it in GitHub Desktop.
CREATE PROCEDURE Operation.CreateSchema
(
@SchemaName NVARCHAR(300)
)
AS
IF NOT EXISTS (SELECT * FROM sys.schemas WHERE name = @SchemaName)
DECLARE @CreateStatement NVARCHAR(MAX) = 'CREATE SCHEMA ' + @SchemaName
PRINT (@CreateStatement)
EXEC sp_executesql @CreateStatement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment