EXEC master.dbo.xp_create_subdir 'C:\SierraBD\App'

USE [master];

IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'BDDat')

BEGIN

CREATE DATABASE [BDApp] ON PRIMARY
( NAME = N'BDApp', FILENAME = N'C:\SierraBD\App\BDApp_Data.mdf' , SIZE = 4096KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON
( NAME = N'BDApp_log', FILENAME = N'C:\SierraBD\App\BDApp_Log.ldf' , SIZE = 4096KB , MAXSIZE = 2048GB , FILEGROWTH = 10%);

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [BDApp].[dbo].[sp_fulltext_database] @action = 'enable'
end;

ALTER DATABASE [BDApp] SET ANSI_NULL_DEFAULT OFF;
ALTER DATABASE [BDApp] SET ANSI_NULLS OFF;
ALTER DATABASE [BDApp] SET ANSI_PADDING OFF;
ALTER DATABASE [BDApp] SET ANSI_WARNINGS OFF;
ALTER DATABASE [BDApp] SET ARITHABORT OFF;
ALTER DATABASE [BDApp] SET AUTO_CLOSE ON;
ALTER DATABASE [BDApp] SET AUTO_SHRINK OFF;
ALTER DATABASE [BDApp] SET AUTO_UPDATE_STATISTICS ON;
ALTER DATABASE [BDApp] SET CURSOR_CLOSE_ON_COMMIT OFF;
ALTER DATABASE [BDApp] SET CURSOR_DEFAULT  GLOBAL;
ALTER DATABASE [BDApp] SET CONCAT_NULL_YIELDS_NULL OFF;
ALTER DATABASE [BDApp] SET NUMERIC_ROUNDABORT OFF;
ALTER DATABASE [BDApp] SET QUOTED_IDENTIFIER OFF;
ALTER DATABASE [BDApp] SET RECURSIVE_TRIGGERS OFF;
ALTER DATABASE [BDApp] SET  DISABLE_BROKER;
ALTER DATABASE [BDApp] SET AUTO_UPDATE_STATISTICS_ASYNC OFF;
ALTER DATABASE [BDApp] SET DATE_CORRELATION_OPTIMIZATION OFF;
ALTER DATABASE [BDApp] SET TRUSTWORTHY OFF;
ALTER DATABASE [BDApp] SET ALLOW_SNAPSHOT_ISOLATION OFF;
ALTER DATABASE [BDApp] SET PARAMETERIZATION SIMPLE;
ALTER DATABASE [BDApp] SET READ_COMMITTED_SNAPSHOT OFF;
ALTER DATABASE [BDApp] SET HONOR_BROKER_PRIORITY OFF;
ALTER DATABASE [BDApp] SET RECOVERY SIMPLE;
ALTER DATABASE [BDApp] SET  MULTI_USER;
ALTER DATABASE [BDApp] SET PAGE_VERIFY CHECKSUM;
ALTER DATABASE [BDApp] SET DB_CHAINING OFF;

END;