/*============================================================================
  File :     SimpleDeploy DBSetup.sql

  Summary:  This script creates the database used in the CLR demos for
			the "Bridging the Gap" session. If executed, this script
			will disable the SQL CLR. Be sure to review before executing. 

  Date:     April 2005

  Tested on SQL Server Version: 9.00.1116.08 (IDW14 - April CTP)
------------------------------------------------------------------------------
  Copyright (C) 2005 Kimberly L. Tripp, SYSolutions, Inc.
  All rights reserved.

  For more scripts and sample code, check out 
    http://www.SQLskills.com

  This script is intended only as a supplement to demos and lectures
  given by Kimberly L. Tripp.  
  
  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF 
  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED 
  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  PARTICULAR PURPOSE.
============================================================================*/

IF DATABASEPROPERTYEX('SimpleDeploy', 'Collation') IS NOT NULL
	DROP DATABASE [SimpleDeploy] 
go

CREATE DATABASE [SimpleDeploy] 
ON PRIMARY 
( NAME = N'SimpleDeployData', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\SimpleDeployData.mdf' , SIZE = 2048KB , FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'SimpleDeployLlog', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\SimpleDeployLlog.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'SimpleDeploy', @new_cmptlevel=90
GO
EXEC [SimpleDeploy].[dbo].[sp_fulltext_database] @action = 'disable'
GO
ALTER DATABASE [SimpleDeploy] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [SimpleDeploy] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [SimpleDeploy] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [SimpleDeploy] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [SimpleDeploy] SET ARITHABORT OFF 
GO
ALTER DATABASE [SimpleDeploy] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [SimpleDeploy] SET AUTO_CREATE_STATISTICS ON 
GO
ALTER DATABASE [SimpleDeploy] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [SimpleDeploy] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [SimpleDeploy] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [SimpleDeploy] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [SimpleDeploy] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [SimpleDeploy] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [SimpleDeploy] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [SimpleDeploy] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [SimpleDeploy] SET RECOVERY FULL 
GO
ALTER DATABASE [SimpleDeploy] SET  MULTI_USER 
GO
ALTER DATABASE [SimpleDeploy] SET PAGE_VERIFY CHECKSUM  
GO

EXEC sp_configure 'CLR Enabled', 0
RECONFIGURE
go

EXEC sp_configure 'show advanced', 0
RECONFIGURE
go

-- Also, clean up the HTTP endpoint created/used in a later demo:
DROP ENDPOINT AddActorEndpoint
go