Solved

create database script - sql server 2000 compatible

Posted on 2009-06-27
5
1,481 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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 24728890
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
ID: 24729082
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
ID: 24729085
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
ID: 24729188
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-
ID: 24729322
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

821 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