Solved

SQL 2000 Script

Posted on 2011-09-13
4
244 Views
Last Modified: 2012-05-12
I need to create this table in my SQL 2000 database but it fails on the contraints beecause they are not supported in 2000.

How can I rewrite this to work or how can I add these contraints to the table if I strip all those off and manually add them?

USE [demodata]
GO

/****** Object:  Table [dbo].[SynSync]    Script Date: 09/13/2011 11:56:19 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[SynSync](
	[TableName] [varchar](20) NOT NULL,
	[KeyValue1] [varchar](80) NOT NULL,
	[KeyValue2] [varchar](80) NOT NULL,
	[KeyValue3] [varchar](80) NOT NULL,
	[KeyValue4] [varchar](80) NOT NULL,
	[KeyValue5] [varchar](80) NOT NULL,
	[Event] [char](10) NOT NULL,
	[EventTime] [datetime] NOT NULL,
 CONSTRAINT [PK_SynSync] PRIMARY KEY CLUSTERED 
(
	[TableName] ASC,
	[KeyValue1] ASC,
	[KeyValue2] ASC,
	[KeyValue3] ASC,
	[KeyValue4] ASC,
	[KeyValue5] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

Open in new window

0
Comment
Question by:red_75116
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 17

Accepted Solution

by:
Kent Dyer earned 500 total points
ID: 36530940
What you can do is to auto-generate the table build script by right-clicking on the table.  Be sure to use the dependencies and triggers, constraints, etc.  Part of the build script should include drops and adds for the SQL script.

Thanks,

Kent
0
 

Author Comment

by:red_75116
ID: 36530955
This loads in 2008 fine, but fails running in 2000.  that is the issue
0
 
LVL 42

Expert Comment

by:dqmq
ID: 36531008
I believe the WITH clause is causing you difficulty. Omit this part:

WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 36531038
Please try the following:

USE [demodata]
GO

/****** Object:  Table [dbo].[SynSync]    Script Date: 09/13/2011 11:56:19 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[SynSync](
	[TableName] [varchar](20) NOT NULL,
	[KeyValue1] [varchar](80) NOT NULL,
	[KeyValue2] [varchar](80) NOT NULL,
	[KeyValue3] [varchar](80) NOT NULL,
	[KeyValue4] [varchar](80) NOT NULL,
	[KeyValue5] [varchar](80) NOT NULL,
	[Event] [char](10) NOT NULL,
	[EventTime] [datetime] NOT NULL,
 CONSTRAINT [PK_SynSync] PRIMARY KEY CLUSTERED 
(
	[TableName],
	[KeyValue1] ,
	[KeyValue2] ,
	[KeyValue3] ,
	[KeyValue4] ,
	[KeyValue5] 
) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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.

752 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