Wednesday, August 17, 2005

 

Visual Studio Database Projects and Command Files

Database Projects in Visual Studio .NET (Good primer by Scott Mitchell)

Visual Studio.NET Database Projects (Excellent in-depth article by Jeffrey McManus and Jackie Goldstein)

After reading the above articles you will learn about creating command (.cmd) files. These files will make your life easier by allowing you to execute one file to complete all of your SQL Server database updates. Unfortunately, if you are using Visual Studio 2005, you will also learn that the "Create Command File" function is now missing from the IDE. You can learn more about this and see an example .cmd file by visiting this blog posting by Kirk Marple.

Using example .cmd file content from both Jefferey McManus and Kirk Marple, as well as well as the osql Utility syntax page, I was able to create my own .cmd file.

Pay careful attention to the line that calls osql. Example:
osql -S %1 -d %2 -U myUsername -P myPassword -b -i "BS_Application_Part1.sql"

Notice that I replace -E (trusted connection) option with -U (username) and -P (password).

Comments: Post a Comment

Links to this post:

Create a Link



<< Home
Content copyright ©2003-2006 Tod Birdsall