Question : How to use Database name variable in ALTER DATABASE sql script

I need to create a script that is equivalent to the following:

ALTER DATABASE DB_NAME()

but that isn't valid syntax.

Is there anyway to do this via Transact SQL or SQLCMD mode other than by using dynamic sql?

Answer : How to use Database name variable in ALTER DATABASE sql script

>>Is there anyway to do this via Transact SQL or SQLCMD mode other than by using dynamic sql? <<
I am afraid not.  You will have to use Dynamic SQL.
Random Solutions  
 
programming4us programming4us