我正在为一个现有的数据库创建数据库脚本。我尝试使用SQL Server为我生成脚本,但是生成的脚本失败了。我使用“Script Table As”>'CREATE To'>'New Query Editor Window'选项。然后我更改表和约束名称并执行脚本。我被卡住了。有人能看出问题在哪里吗?
我收到这个错误:
Msg 170, Level 15, State 1, Line 17
Line 17: Incorrect syntax near '('.
生成的SQL语句:
USE [MyDatabase]
GO
/****** Object: Table [dbo].[MyTable2] Script Date: 01/06/2009 14:40:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MyTable2](
[id] [int] IDENTITY(1,1) NOT NULL,
[u_id] [int] NOT NULL,
[prog_number] [varchar](5) NOT NULL,
[trans_id] [varchar](50) NULL,
[code] [varchar](7) NULL,
[user_num] [char](9) NULL,
[is_found] [char](9) NULL,
[status] [char](1) NULL,
[status2] [char](1) NULL,
[inserted_timestamp] [datetime] NULL CONSTRAINT [DF_MyTable2_inserted_timestamp] DEFAULT (getdate()),
[s_id] [varchar](10) NULL,
[p_value] [char](4) NULL,
CONSTRAINT [PK_MyTable2] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF