I\'m trying to switch the current database with a SQL statement. I have tried the following, but all attempts failed:
If SQLCMD is an option, it supports scripting variables above and beyond what straight T-SQL can do. For example: http://msdn.microsoft.com/en-us/library/ms188714.aspx