简体   繁体   English

如何从Visual Studio 2013或2010中的解决方案资源管理器运行sql脚本

[英]How to run sql script from the solution explorer in Visual Studio 2013 or 2010

I have a Visual Studio 2008 solution containing a "database project". 我有一个包含“数据库项目”的Visual Studio 2008解决方案。 From there I can run .sql files, by right-clicking them, like this: 从那里我可以运行.sql文件,通过右键单击它们,如下所示:

db项目 -  vs2008解决方案


However, I imported this project to both Visual Studio 2010 (resulting in a .dbproj file) and VS2013 (ending .sqlproj file), and now I cannot find that option anymore. 但是,我将此项目导入Visual Studio 2010(生成.dbproj文件)和VS2013(结束.sqlproj文件),现在我再也找不到该选项了。

Also, I can't figure out how to add a database reference to my production server, just like I used to do. 此外,我无法弄清楚如何将数据库引用添加到我的生产服务器,就像我以前一样。

I did try to create a new project in these newer versions as well, but no good. 我确实试图在这些较新的版本中创建一个新项目,但没有好处。

So, two questions. 那么,有两个问题。 First, how to add my db reference, and second, how to run the .sql script under that reference? 首先,如何添加我的数据库引用,第二,如何在该引用下运行.sql脚本?


Edit A fellow coworker also has this same issue: How to create a database project in Visual Studio 2013 编辑同事也有同样的问题: 如何在Visual Studio 2013中创建数据库项目


Edit2 Tried this from msdn: How to: Run SQL Scripts in Solution Explorer , but no success. Edit2尝试从msdn: 如何:在解决方案资源管理器中运行SQL脚本 ,但没有成功。 The "Run" and "Run On" options aren't there, and dragging the script to the database reference didn't work as well. “运行”和“运行”选项不存在,将脚本拖动到数据库引用也不起作用。

在此输入图像描述

Also found the following related question: visual studio extension to execute sql 还发现了以下相关问题: visual studio扩展执行sql

When you create a new Project, do you have the "SQL Server Database Project" available? 创建新项目时,您是否有“SQL Server数据库项目”?

Have you tried the solution in this post ? 在这篇文章中试过这个解决方案吗?

在此输入图像描述

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

相关问题 Visual Studio for SSRS 2008 - 如何在解决方案资源管理器中将报表组织到子文件夹中? - Visual Studio for SSRS 2008 - How to organize reports into subfolders in Solution Explorer? Visual Studio 2013 SQL Compact - Visual Studio 2013 SQL Compact 将查询添加到Visual Studio 2013中的服务器资源管理器后,将查询发送到SQL Server - Sending Queries to SQL Server once added to server explorer in Visual Studio 2013 在Visual Studio 2010中保存SQL - Saving SQL in Visual Studio 2010 从 Visual Studio 2013 数据库项目中清理 SQL Server 数据库 - Clean SQL Server database from Visual Studio 2013 database project 使用Visual Studio 2012打开Visual Studio 2010解决方案时需要什么版本的SQL Server? - What version of SQL server do I need when I open a Visual Studio 2010 solution with Visual Studio 2012? 从 Visual Studio 2010 打开 SQL Server Data Tools 时如何解决错误 - How to solve error when opening SQL Server Data Tools from Visual studio 2010 将文件从Excel 2010导入到Visual Studio SQL Server - Importing a file from Excel 2010 to visual studio SQL Server 从SQL表查询Visual Studio 2010负载测试数据 - Querying Visual studio 2010 load test data from SQL table 如何使用Visual Studio 2010和SQLEXPRESS将表从一个SQL Server数据库复制到另一个数据库 - How can I copy tables from one SQL Server database to another using Visual Studio 2010 & SQLEXPRESS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM