简体   繁体   中英

Visual studio 2010 sql project - how to run?

I have a SQL project in my .Net project in Visual Studio 2010. I added it to my solution because I thought it will help me to create all the database objects in more environment without difficulties. My scope is to create/define the database objects (tables and stored procedures) in more computers, easily.For this purpose I created an Sql project in visual studio and I added for each table and stored procedure the creation script in this project. Now I have 30 scripts and I'd like to run it on a new sql instance.

If I open each sql file I have, in visual studio, an toolbat that allows me to tun the opened file on a sql instance (I have an connect button) and this generates the proper object (table or SP).

The question is: how do I do to run all the files in this project in one click. How to create all the objects in one click? Now I have about 30 scripts to run, and I need a proper way.

The way I tried to do it was to set as default project the sql project and to press run (F5), but then I got some strange compilation errors in sql files, errors witch didn't was there when I run (execute) each script individually.

Here is the right click menu for this project (No Run, Publish or something else!): 在此处输入图片说明

I tried to use from that menu the Deploy command. The bad news (for me) is that I got this on that command: 在此处输入图片说明

I don't have any error in my sql scripts, each one runs correctly.

Thank you.

使用需要将您的项目部署到数据库上,从而使用“ Deploy菜单项。

The way database projects work, is that they compare the schema in the project to the schema at the destination.

What this means is you shouldn't have an use statements, or alter statements, ect...

What does one of those procs look like that is throwing the error?

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