简体   繁体   中英

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. I'm using SQL Server Database Tools (SSDT) through Visual Studio 2012 and have been able to get the schema migrated. I've got a separate SSIS package which migrates the data over.

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:

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:

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. 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.

Thanks anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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