npsdb is variable that contains the new name of the new database. - The UI will declare the variable and initialize it based ...

-- npsdb is variable that contains the new name of the new database.
-- The UI will declare the variable and initialize it based on the user input.
-- The following statements will be execute prior to the following script:
-- DECLARE @npsdb nvarchar(MAX)
-- SET @npsdb = database name from the connection string

exec(N'CREATE DATABASE [' + @npsdb + N'] COLLATE SQL_Latin1_General_CP1_CI_AS')

exec sp_dboption @npsdb, N'autoclose', N'false'

exec sp_dboption @npsdb, N'bulkcopy', N'false'

exec sp_dboption @npsdb, N'trunc. log', N'false'

exec sp_dboption @npsdb, N'torn page detection', N'true'

exec sp_dboption @npsdb, N'read only', N'false'

exec sp_dboption @npsdb, N'dbo use', N'false'

exec sp_dboption @npsdb, N'single', N'false'

exec sp_dboption @npsdb, N'autoshrink', N'false'

exec sp_dboption @npsdb, N'ANSI null default', N'false'

exec sp_dboption @npsdb, N'recursive triggers', N'false'

exec sp_dboption @npsdb, N'ANSI nulls', N'false'

exec sp_dboption @npsdb, N'concat null yields null', N'false'

exec sp_dboption @npsdb, N'cursor close on commit', N'false'

exec sp_dboption @npsdb, N'default to local cursor', N'false'

exec sp_dboption @npsdb, N'quoted identifier', N'false'

exec sp_dboption @npsdb, N'ANSI warnings', N'false'

exec sp_dboption @npsdb, N'auto create statistics', N'true'

exec sp_dboption @npsdb, N'auto update statistics', N'true'

if( ( (@@microsoftversion / power(2, 24) = 8) and (@@microsoftversion  0xffff >= 724) ) or 
    ( (@@microsoftversion / power(2, 24) = 7) and (@@microsoftversion & 0xffff >= 1082) ) )
    exec sp_dboption @npsdb, N'db chaining', N'false'

GO