views:

275

answers:

2

Does anybody know how I can execute a .sql file from within solution explorer in VS 2008 Professional?

I know you can do this in VS 2005 but cannot find this feature in VS 2008 professional

A: 

If it's within a database project, then you can right click on it and choose "Run" or "Run On...".

David M
I have a database project. But I dont get the "Run" option in the menu. I have Visual Studio 2008 Professional. I am not sure it matters. I also dont see that "Database reference" the MSDN is talking about.
Vilasack Phothisan
A: 

Use the "Server Explorer" (Ctrl+W, L) to add a connection, then once a connection is open you can right-click the server node and select "New Query". This will allow you to paste in the contents of an SQL file.

Alternatively open the SQL file, then from the "T-SQL Editor" toolbar you can choose "Connect" from your saved connections, and then select the database in the drop-down box.

Codesleuth
Where is the "T-SQl Editor" toolbar?
Vilasack Phothisan
Go to "View" -> "Toolbars" and select "T-SQL Editor".
Codesleuth
What version is VS 2008 do you have? I do not see it in my list.
Vilasack Phothisan
Does "T-SQL Editor" come with the defualt install?
Vilasack Phothisan