Using Management Studio (for MS SQL server 8) I had created a table, given a primary key and created a unique key.
I then had the management studio "script 'create' to file" and it saved an SQL statement (below).
I then dropped/deleted the table and tried to execute the creation statement.
It says "Incorrect syntax near '('. " and references the block connected with the "WITH" statement. (Actually both of them cause the error and removing them gets rid of it.
Is there a way to keep the information contained in the WITH statement in my table creation SQL? Is it even required info?
[code=sql]
USE [MyProducts]
GO
/****** Object: Table [dbo].[Category] Script Date: 10/12/2007 11:22:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFI ER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Category]
(
[CategoryID] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) NOT NULL,
[CategoryNumber] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED
(
[CategoryID] ASC
)
WITH
(
PAD_INDEX = OFF,
STATISTICS_NORE COMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCK S = ON
) ON [PRIMARY],
CONSTRAINT [IX_UniqueCatego ryNumber] UNIQUE NONCLUSTERED
(
[CategoryNumber] ASC
)
WITH
(
PAD_INDEX = OFF,
STATISTICS_NORE COMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCK S = ON
) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
[/code]
I then had the management studio "script 'create' to file" and it saved an SQL statement (below).
I then dropped/deleted the table and tried to execute the creation statement.
It says "Incorrect syntax near '('. " and references the block connected with the "WITH" statement. (Actually both of them cause the error and removing them gets rid of it.
Is there a way to keep the information contained in the WITH statement in my table creation SQL? Is it even required info?
[code=sql]
USE [MyProducts]
GO
/****** Object: Table [dbo].[Category] Script Date: 10/12/2007 11:22:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFI ER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Category]
(
[CategoryID] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) NOT NULL,
[CategoryNumber] [int] NOT NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED
(
[CategoryID] ASC
)
WITH
(
PAD_INDEX = OFF,
STATISTICS_NORE COMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCK S = ON
) ON [PRIMARY],
CONSTRAINT [IX_UniqueCatego ryNumber] UNIQUE NONCLUSTERED
(
[CategoryNumber] ASC
)
WITH
(
PAD_INDEX = OFF,
STATISTICS_NORE COMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCK S = ON
) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
[/code]
Comment