Convert Single SQLSERVER 2005 Script to a SQL SERVER 2000 script

心不动则不痛 提交于 2019-12-13 00:13:10

问题


Hi guys first of all I have no expirience with DB programing only basic SQL queries.

I have an sql script that was devolped for SQL Server 2005 FB and I need to run it in SQL server 2000.

I don't have the original 2005 DB. only a script and a SQL 2000DB

I found many guides for converting a whole DB but what can I do with a single script?

it is a very long script that I cannnot share here because of datasecurity issues.

here is the error

please assist me.

回答1:


The syntax for specifying index options has changed - look closely at the WITH clause:

SQL Server 2000

CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name
    ON { table | view } ( column [ ASC | DESC ] [ ,...n ] )
[ WITH < index_option > [ ,...n] ]
[ ON filegroup ]

SQL Server 2005 and later

CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name 
    ON <object> ( column [ ASC | DESC ] [ ,...n ] ) 
    [ INCLUDE ( column_name [ ,...n ] ) ]
    [ WITH ( <relational_index_option> [ ,...n ] ) ]
    [ ON { partition_scheme_name ( column_name ) 
         | filegroup_name 
         | default 
         }
    ]
[ ; ]

The WITH clauses in your script use parentheses  and that causes the error. Unless you know that the script sets some specific index options, you can simply remove all the WITH ( ... ) clauses.




回答2:


Look at this 10-minute solution to learn how to recreate your database using "Generate SQL Server Scripts" wizard. This works while dowangrading from SQL Server 2008 to SQL Server 2005, but it may help to downgrade the DB from 2005 to 2000.

there is the link to MS SQL Server 2005 programmability enhancements.



来源:https://stackoverflow.com/questions/9925385/convert-single-sqlserver-2005-script-to-a-sql-server-2000-script

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