Most developers forget that it exists, and DBAs never even know that it’s there: Visual Studio’s External Tools (Menu > Tools > (your personalized Tools here). Here are just a few examples of database tasks that a DBA might want on the External Tools menu, to get you started:
1. Run SQLCMD with an existing .sql file
Command: C:Program FilesMicrosoft SQL Server100ToolsBinnSQLCMD.EXE
Initial directory: In this example, chose $(SolutionDir) to show an example of using file at root of Solution
Arguments: These are sqlcmd arguments: –E (use trusted connection) –i input file
2. Run a selected Batch File
Initial directory: In this example, chose $(ItemDir) to show an example of using the directory of the file that is currently selected in Solution Explorer
Arguments: The /c parameter “carries out the command specified by string and then terminates”. The $(ItemPath) says to use the file that is currently selected in Solution Explorer.
3. Run a Powershell script
Initial directory: In this example, leave blank to show using an absolute path
Arguments: –ExecutionPolicy RemoteSigned to set the executionpolicy needed for the file being executed. The –file parameter points to the file being executed.
Reference for External Tools Arguments: http://msdn.microsoft.com/en-us/library/ekbzk5f8.aspx