Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL 2000 Script

Posted on 2011-09-13
4
Medium Priority
?
250 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Ready to get certified? Check out some courses that help you prepare for third-party exams.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

916 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