I have a trigger written in C# that is currently active on a production database. In order to test something things out, I want the trigger to be active on a test database as well. How do I make sure the trigger gets deployed to both the production and test databases?
As far as I can tell, the way the trigger gets deployed right now is:
- In Visual Studio, when I look at the properties of my code solution/project, there’s a place for a database connection string. This string specifies the production database.
- When I go to Build -> Deploy Solution in Visual Studio, this deploys the trigger to the production database specified in the connection string.
So I guess another way of looking at the question is: is there some way of specifying multiple databases in the connection string?
I’m assuming you’re using VS2010 database projects. Rather than using Visual Studio to deploy you could use the VSDBCMD utility. You can specify a connection string as a command line argument and then you could run the utility twice with different connection strings.
Another option would be to set up multiple project configurations in Visual Studio with a different connection string for each.
The Visual Studio Database Guide written by the Visual Studio ALM Rangers may be a useful resource.