Solved

SQL 2000 Script

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

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
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

617 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