I need to execute the following statement
ALTER DATABASE DatabaseName ...
in my .sql script. But I want to keep my script neutral to the specific database. So I want to make ALTER DATABASE work on the current database. I hoped DatabaseName is optional parameter, but according to documentation, it is not.
Database name is required and you cannot even put it in a parameter.
But you can use ‘exec’ instead
It is not very elegant, but i believe it is the only way to do it