Solved

How to run SQL Scripts in Visual Studio 2012

Posted on 2013-05-24
3
491 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
3 Comments
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 300 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

839 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