Thursday, March 29, 2012

Create Table syntax SQL in SQL Server 7

Hi guys,I need to pass some SQL to someone else who will run it on their database. I have got the SQL for SQL Server 2000 but they are running SQL Server 7. Apparently the below MSSQL 2000 script doesn't work;SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[tableName]( [id] [int] IDENTITY(1,1) NOT NULL, [ArticleID] [int] NULL, [Heading] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [BodyContent] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [WrittenDate] [datetime] NULL,CONSTRAINT [tableName] PRIMARY KEY CLUSTERED ( [id] ASC ))What is the equivalent of the above in for SQL Server 7? I don't have access to it via SQL Server Manager so have to run the script.

Looks like the forum didn't like Safari. I'll try that againwith Firefox and see if that comes out a bit better. SO to summarise,how do I do the following in SQL Server 7, as this is for SQL Server2000 and I don't know what the syntax difference is:

SET

ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tableName]

( [id] [int] IDENTITY(1,1) NOT NULL,

[ArticleID] [int] NULL,

[Heading] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

[BodyContent] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

[WrittenDate] [datetime] NULL,

CONSTRAINT [tableName] PRIMARY KEY CLUSTERED ( [id] ASC ))

|||

I've written this in what should be OK in SQL Server 7. Idon't have anyway of testing this, and would prefer that it is correctbefore sending it. So, is the below equivalent to the SQL Server 2000code above:

CREATE TABLE tableName
(
id int IDENTITY NOT NULL,
ArticleID text,
Heading text,
BodyContent text,
WrittenDate datetime
)

This doesn't seem to specify any primary key, how do I do that if indeed I need to?

Slowly realising how much I rely on SQL Server Managment studio...!

No comments:

Post a Comment