Solved

create database script - sql server 2000 compatible

Posted on 2009-06-27
5
1,465 Views
Last Modified: 2012-05-07
I am running Sql Server Management Studio Express 2005 and have a database that I need to install on a remote sql server box running Sql Server 2000 (8.0.194).

I am connected to the remote server thru the Object Explorer.  I though the easiest way to recreate the database was to script the database and tables and then load the data.  However, when I tried to run the create database script I got the following errors:

Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'ENABLE_BROKER'.
Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'AUTO_UPDATE_STATISTICS_ASYNC'.
Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'DATE_CORRELATION_OPTIMIZATION'.
Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'TRUSTWORTHY'.
Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'ALLOW_SNAPSHOT_ISOLATION'.
Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'PARAMETERIZATION'.
Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'CHECKSUM'.
Msg 102, Level 15, State 6, Line 1
Incorrect syntax near 'DB_CHAINING'.

Here is my create database script:






USE [master]
GO
/****** Object:  Database [databasename]    Script Date: 06/27/2009 13:56:20 ******/
CREATE DATABASE [databasename] ON  PRIMARY
( NAME = N'databasename', FILENAME = N'c:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\databasename.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON
( NAME = N'databasename_log', FILENAME = N'c:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\databasename_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
 COLLATE SQL_Latin1_General_CP1_CI_AS
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'databasename', @new_cmptlevel=80
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [databasename].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [databasename] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [databasename] SET ANSI_NULLS OFF
GO
ALTER DATABASE [databasename] SET ANSI_PADDING OFF
GO
ALTER DATABASE [databasename] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [databasename] SET ARITHABORT OFF
GO
ALTER DATABASE [databasename] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [databasename] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [databasename] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [databasename] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [databasename] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [databasename] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [databasename] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [databasename] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [databasename] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [databasename] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [databasename] SET  ENABLE_BROKER
GO
ALTER DATABASE [databasename] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [databasename] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [databasename] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [databasename] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [databasename] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [databasename] SET  READ_WRITE
GO
ALTER DATABASE [databasename] SET RECOVERY SIMPLE
GO
ALTER DATABASE [databasename] SET  MULTI_USER
GO
ALTER DATABASE [databasename] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [databasename] SET DB_CHAINING OFF

Is there an easier way to create the database on the remote server?  I don't have access to remote desktop into the server and place a backup on the drive and then restore or place the .mdf file and attach.  I have to create the database locally from within SQL Server Management Studio Express 2005 object explorer.

Any help is appreciated.
Thanks.
0
Comment
Question by:-Dman100-
5 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
Comment Utility
you should, instead of developing on a sql 2005 instance, develop on the sql 2000 instance, avoiding all these problems. upgrading is much easier than downgrading.
so, my suggestion is:
install sql 2000 express edition/msde as a named instance (on the same box), and you can still use the sql 2005 management studio to connect to it.
0
 
LVL 22

Assisted Solution

by:8080_Diver
8080_Diver earned 250 total points
Comment Utility
In looking at your script . . . what are you setting ENABLE_BROKER , etc., to?  You have specified an ON/OFF setting for the other things but nothing for those. ;-)
0
 
LVL 22

Assisted Solution

by:8080_Diver
8080_Diver earned 250 total points
Comment Utility
You might want to try using Management Studio to script out the databse  that you have created and then look at the script that it generates and see how it looks. ;-)
0
 
LVL 23

Assisted Solution

by:Racim BOUDJAKDJI
Racim BOUDJAKDJI earned 125 total points
Comment Utility
In addition to angelIII's sound advice...

Actually the message error tells you exactly that the options that are unknown in a SQL 2000 compatible environment.  Simply take them away from the script and re run
0
 

Author Comment

by:-Dman100-
Comment Utility
Thanks guys...I was able to use Sql Publishing Wizard to target sql server 2000 and script out the schema and data.  It worked like a charm.  I appreciate the suggestions though.

Regards.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now