Nedenstående forespørgselsblok kan være nyttig.
DECLARE @Query VARCHAR(MAX)=''
DECLARE @DbName VARCHAR(400) = 'Db1'
DECLARE @DbFilePath VARCHAR(400) = 'E:\Database\'
SET @Query = @Query + 'CREATE DATABASE 'example@sqldat.com +' ON PRIMARY '
SET @Query = @Query + '( NAME = '''example@sqldat.com +''', FILENAME = '''example@sqldat.comexample@sqldat.com +'.mdf'' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) '
SET @Query = @Query + ' LOG ON '
SET @Query = @Query + '( NAME = '''example@sqldat.com +'_log'', FILENAME = '''example@sqldat.comexample@sqldat.com +'_log.ldf'' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)'
print @query
exec(@query)