Solved

How to run SQL Scripts in Visual Studio 2012

Posted on 2013-05-24
3
503 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

717 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