I use the database name in several places in my script and I want to be able to quickly change it, so I'm looking for something like this:
DECLARE @DBNAME VARCHAR(50)
SET @DBNAME = 'TEST'
CREATE DATABASE @DBNAME
GO
ALTER DATABASE @DBNAME SET COMPATIBILITY_LEVEL = 90
GO
ALTER DATABASE @DBNAME SET RECOVERY SIMPLE
GO
But it doesn't work. So what's the correct way to write this code?
Thanks