Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Create Table fails

Author  Topic 

jp2code
Posting Yak Master

175 Posts

Posted - 2011-08-25 : 12:50:03
I manually created a table in our SQL Server, realized the ID column needed to be an nvarchar instead of an int, but wasn't able to change it. I was told I needed to drop the table and re-add it.

Before dropping the table, I scripted the CREATE command so I could just edit that to recreate the table to save some time.

Now, whenever I attempt to execute the script, I get Line 20: Incorrect syntax near '('.

I'm guessing the syntax is still correct, but something is wrong with changing my Primary Key from ID int to LineID nvarchar(10).

Could someone tell me how to resolve this?

USE [ProductionLine]
GO

/****** Object: Table [dbo].[Error_Table] Script Date: 08/25/2011 11:36:48 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Error_Table](
[LineID] [nvarchar](10) NOT NULL,
[Date] [datetime] NOT NULL,
[WO] [nvarchar](10) NULL,
[Module] [nvarchar](10) NULL,
[DSO] [nvarchar](10) NULL,
[INT1] [nvarchar](10) NULL,
[Unit] [nvarchar](10) NULL,
[Contact] [nvarchar](50) NULL,
[Category] [nvarchar](10) NULL,
[Problem] [nvarchar](50) NULL,
[Solution] [nvarchar](255) NULL,
[Action] [nvarchar](255) NULL,
[Actor] [nvarchar](50) NULL,
[Acted] [datetime] NULL,
CONSTRAINT [PK_Error_Table] PRIMARY KEY CLUSTERED (
[LineID] 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
Thank you,

~Joe
Avoid Sears Home Improvement (read why)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-25 : 13:10:55
you're missing a closing braces ( in the end

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jp2code
Posting Yak Master

175 Posts

Posted - 2011-08-25 : 13:52:37
I'm using Management Studio 2008 with Intellisense, and it shows matched "(" and ")" pairs.

Did you really see this? If so, please help this blind nut.

~Joe
Avoid Sears Home Improvement (read why)
Go to Top of Page

jp2code
Posting Yak Master

175 Posts

Posted - 2011-08-25 : 14:28:38
Well, I don't know what all that stuff on the end was, so I just deleted it off and went with this:
USE [ProductionLine]
GO

/****** Object: Table [dbo].[Error_Table] Script Date: 08/25/2011 11:36:48 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Error_Table](
[LineID] [nvarchar](10) NOT NULL,
[Date] [datetime] NOT NULL,
[WO] [nvarchar](10) NULL,
[Module] [nvarchar](10) NULL,
[DSO] [nvarchar](10) NULL,
[Initial] [nvarchar](10) NULL,
[Unit] [nvarchar](10) NULL,
[Contact] [nvarchar](50) NULL,
[Category] [nvarchar](10) NULL,
[Problem] [nvarchar](50) NULL,
[Solution] [nvarchar](255) NULL,
[Action] [nvarchar](255) NULL,
[Actor] [nvarchar](50) NULL,
[Acted] [datetime] NULL
)
GO
From there, I went into Table Designer to assign my primary key field.

~Joe
Avoid Sears Home Improvement (read why)
Go to Top of Page
   

- Advertisement -