?
Solved

How to run SQL Scripts in Visual Studio 2012

Posted on 2013-05-24
3
Medium Priority
?
506 Views
Last Modified: 2013-06-10
I just installed Visual Studio 2012, having previously been on 2008. I need to work on SQL scripts, and be able to run selected lines of SQL within the .sql file. I'd also like to create a project to store all my scripts, which relate to the same scope of work. I've created the database project and imported all the .sql files that I need (that I had previously developed in SSMS), but I can't find a way to run those scripts against the desired database. I don't seem able to set up a database reference, or I just don't know how to do that, but I'm not certain that's what I need to do. I'm also not certain that I can do what I want within the structure of a database project, but that's where I am right now. I've figured out how to do one-off files, as in SSMS, but I was hoping this would help me organize my work better.

Any suggestions anyone?
0
Comment
Question by:DanielBorson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 900 total points
ID: 39195261
you can do that

in the menu check for SQL --> Transact SQL editor --> New Query.
This will open a new query window for you to execute your SQL within visual studio.
0
 
LVL 10

Expert Comment

by:Matt Bowler
ID: 39198336
Visual Studio 2012 database projects are mainly geared towards database deployment scripts. If you have SQL Server installed locally you can use SQL Server Management Studio - this will allow you to keep scripts together in projects and define connection managers etc...
0
 

Author Comment

by:DanielBorson
ID: 39236238
I had figured out how to do a query, but VS12 is not really set up for complex queries in the same way that SSMS is. I ended up installing SSMS separately and using that. It had initially appeared that I could finally do it all in one tool, but alas, that was not the case.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question