Hi,
I have a sql script that references a database explicitly, but the name of that database changes. Rather then have to find anywhere I reference that database and change it, i would like to just set it in one spot.
For example.
SELECT * FROM [V1_Database].[a_table]
I then decide to upgrade from V1 to V2.
Instead of having to find the above code in all of my stored procs and manually change it, I would like to do the following.
SET dbName = 'V2_Database' (Database wide variable)
SELECT * FROM [dbName].[a_table]
But I don't want to have to make all of the places that reference a specific database into string executions. ( strSQL = 'SELECT * FROM [' + dbName + ']' )
I hope i havent made this too confusing, but any help is appreciated.
Thanks,
Brian
You could put the connectionstring in web.config file and use it across your application. That way you would only need to change at one place.