Solved

SQL 2000 Script

Posted on 2011-09-13
4
240 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

747 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

15 Experts available now in Live!

Get 1:1 Help Now