I need to run update script on current database (ALTER DATABASE...), but can’t use implicit its name. Is possible to use some function to get current db name and use inside ALTER DATABASE (Sql Server 2005 and above) ? I tried use db_name(), but doesn’t work.
select db_name(); works
ALTER DATABASE db_name() ... doesn’t work
You need to use something like
or.. even simpler