简体   繁体   English

SSDT VS2012迁移到Azure不正确的语法错误

[英]SSDT VS2012 migration to Azure Incorrect syntax error

I'm trying to automate the publication of a SQL Server 2008 R2 database over to SQL Azure. 我正在尝试自动将SQL Server 2008 R2数据库的发布发布到SQL Azure。 I'm using SQL Server Database Tools (SSDT) through Visual Studio 2012 and have been able to get the schema migrated. 我正在通过Visual Studio 2012使用SQL Server数据库工具(SSDT),并且能够迁移架构。 I've got a separate SSIS package which migrates the data over. 我有一个单独的SSIS程序包,用于迁移数据。

The problem I'm having is that SSDT creates the Azure database as a Web 1GB database, I'm trying to use the following code to convert it into a Business 10GB database: 我遇到的问题是SSDT将Azure数据库创建为Web 1GB数据库,我正在尝试使用以下代码将其转换为Business 10GB数据库:

ALTER DATABASE TestDataase MODIFY(EDITION='Business', MAXSIZE=10GB)

This code works if I execute it in Management Studio however when I put a script into VS and try to build the project I get 3 errors: 如果在Management Studio中执行该代码,则该代码有效,但是当我将脚本放入VS并尝试构建项目时,出现3个错误:

SQL80001: Incorrect syntax near '('.  Expecting FILE, ID or LOG_ON
SQL80001: Incorrect syntax near 'EDITION'.  Expecting '(' or SELECT

I've tried putting the script as a script to be included in build which adds the following error 我尝试将脚本作为要包含在构建中的脚本添加,这增加了以下错误

SQL70001: This statement is not recognized in this context

And putting it as a post deployment script which allow the project to build fine but when I deploy it it fails with the message: 将其作为部署后脚本可以使项目构建良好,但是当我部署它时,它会失败并显示以下消息:

An error occurred while the batch was being executed

Anyone got any ideas where I'm going wrong? 有人知道我要怎么做吗?

Hope you can help 希望你能帮忙

Thanks 谢谢

Alex 亚历克斯

After doing some more digging and testing I worked out what the problem was. 经过更多的挖掘和测试之后,我找出了问题所在。 I was connected to the database I wanted to change rather than to the master database. 我已连接到要更改的数据库,而不是master数据库。 Obviously Azure doesn't allow the USE Database command so I added the script with it's own connection details at the start of the SSIS package which loads the data. 显然,Azure不允许使用USE Database命令,因此我在加载数据的SSIS包的开头添加了脚本及其自身的连接详细信息。

Thanks anyway. 不管怎么说,还是要谢谢你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM