此腳本是從SQL Server Management Studio生成的。爲什麼我得到這個錯誤,我該如何解決ALTER腳本?請注意,我將單詞「CREATE」更改爲「ALTER」。所以我猜CREATE語法與ALTER語法略有不同,或者有更少的限制。我正在使用SQL Server 2008 Express。我看到它告訴我以分號結束,但我想確保終止該聲明以後不會引起任何問題。如果您可以描述查詢的每一部分以及我們正在更改的內容,則會獎勵獎勵積分。T-SQL:對ALTER TABLE腳本崩潰修改CREATE TABLE腳本
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--CREATE TABLE [dbo].[defect](
ALTER TABLE [dbo].[defect](
[defect_id] [bigint] IDENTITY(1,1) NOT NULL,
[defect_number] [nvarchar](50) NULL,
[defect_type] [nvarchar](50) NULL,
[date_created] [datetime] NULL,
[user_identified_by] [nvarchar](50) NULL,
[status] [nvarchar](50) NULL,
[date_modified] [datetime] NULL,
[user_qa] [nvarchar](50) NULL,
[severity] [nvarchar](50) NULL,
[environment] [nvarchar](50) NULL,
[user_assigned] [nvarchar](50) NULL,
[project] [nvarchar](50) NULL,
[target_table_affected] [nvarchar](50) NULL,
[required_for_go_live] [nvarchar](50) NULL,
[project_phase] [nvarchar](50) NULL,
[completion_hours] [nvarchar](50) NULL,
[date_migrate_prod] [datetime] NULL,
[description] [text] NULL,
[table_columns_affected] [text] NULL,
[sample_data] [text] NULL,
[action_taken] [text] NULL,
[supp_detail_links] [text] NULL,
[supp_detail_links_dtml] [text] NULL,
[thread] [bigint] NULL,
CONSTRAINT [PK_defect] PRIMARY KEY CLUSTERED
(
[defect_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
錯誤:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '('.
Msg 319, Level 15, State 1, Line 29
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
+1僅用於在線推薦圖書。 – MatBailie 2012-08-16 07:56:21
我很驚訝,我的問題得到了-2,但我爲它贏得了「熱門問題」徽章。 – MacGyver 2013-03-13 17:09:03