TSD3020: The database name is invalid. The substitute value '$(databasename)' should be used.

This error occurs if you specify the name of a database in an ALTER DATABASE statement. If you use this type of statement in an object definition, pre-deployment script, or post deployment script, you must use the replacement parameter $(databasename). When you deploy your changes, the replacement parameter is automatically replaced with the name of the target database.

To correct this error

  1. Right-click the object or script in your database project that contains the ALTER DATABASE statement, and click Open.

    The script opens in the Transact-SQL (T-SQL) editor.

  2. Change the ALTER DATABASE DatabaseName to be ALTER DATABASE $(databasename).

  3. Save the script.

  4. Rebuild your database project.

See Also

Tasks

How to: Prepare Database Build Scripts

Concepts

An Overview of Database Scripts
Troubleshooting Data Generation Issues
Terminology Overview of Team Edition for Database Professionals