Posts

Showing posts with the label Configuration Management

Running multiple scripts via SQLCMD

On some of our applications we have multiple database scripts that we need to run in a specific sequence as part of a release. Using  SQLCMD  you can write a quick and easy script to do the job for you. There are other more involved alternatives such as using a Visual Studio Database Project, using Entity Framework Code First migrations or creating custom builds but sometimes a simple solution is all you need. STEP 1  -  enable  SQLCMD In SQL Server Management Studio (SSMS), go to the Query menu and select  SQLCMD STEP 2  -  connect to a db server this would be the same value as your SSMS connection server name by simply changing this value, you can run these scripts on any other environment :CONNECT mysqlserver.com STEP 3  -  set the variable path move all the scripts you want to run in a single folder and set the full path to it :SETVAR path "c:\myscriptsfolder" STEP 4  -  (optional) add standard T-SQL sta...

Single connection string for Multiple developers

Our development team has been growing as new capabilities and features are being added.  Having to deal with web.config changes and TFS can become frustrating so here's what we found to be the easiest solution without having to manage several *.config files (and additional accompanying sub-config files) and having to deal with what to check-in to TFS and what not to. Database Alias  to the rescue... ask each developer on your team to do the following : STEP 1  - Run SQL Server Configuration Manager   STEP 2  - C heck that  SQL Server Browsing is running - click on  SQL Server Services -  check that    SQL Server Browsing   is set to     Automatic     -  double click > go to Service > change Start to Automatic > Click OK  STEP 3  - Get the TCP/IP Port Number - Under SQL Server Network Configuration, click on  Protocols for ... -   TCP/IP   sh...