Learn how to create schema dynamically utilizing dynamic SQL


On this quick publish I’ll present you the right way to create database schema utilizing dynamic SQL.

It’s straightforward, simply check out the next code:

declare @SchemaName varchar(max)

set @SchemaName = ‘YOUR_SCHEMA_NAME’

if not exists (choose 0 from sys.schemas the place identify=@SchemaName)

exec(‘create schema [‘+@SchemaName+‘]’)

go

 

Get pleasure from!



Supply hyperlink

Leave a Reply

Your email address will not be published. Required fields are marked *