Microsoft SQL Service Management Studio 2005 'Script XXX as CREATE To' problem

女生的网名这么多〃 提交于 2020-01-11 07:54:09

问题


When using the 'Script Index as CREATE To' to duplicate an index from one table to another table I am not able to run the script. Without editing the generated code I get an error. I get the same error when working with any 'Script XXX as CREATE To' generated code. Any comments/suggestions to solve this problem?

ERROR:

Msg 170, Level 15, State 1, Line 6 Line 6: Incorrect syntax near '('.

SCRIPT:

CREATE NONCLUSTERED INDEX [IX_IncidentStop_Note] ON [dbo].[IncidentStop_Note] 
(
    [IncidentStopID] ASC,
    [NoteID] ASC,
    [Active_Fl] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

EDIT:

As from the answer from Stuart Ainsworth it turns out I am in SQL Server 2000 (80) Compatibility level. My question would slightly change to how can I duplicate something from one table to another while working in 2005 but having the compatibility level of 2000?


回答1:


What's the compatibility mode or server level set to for the destination database? Is it SQL 2000 (or compatibility mode 80)? If so, then the WITH option will not run; the syntax generated by the SQL 2005 Mgmt Studio is 2005 compliant (even if you issue it against a SQL 2000 server or 2000-compliant database).



来源:https://stackoverflow.com/questions/1539549/microsoft-sql-service-management-studio-2005-script-xxx-as-create-to-problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!