DF028: Hardcoded database name is used.

The topic describes the DF028 T-SQL code analysis rule.

Category

EXECUTION RULES

Message

Hardcoded database name is used.

Description

Do not use hardcoded database names to avoid portability and/or deployment issues.

Additional information

Hardcoded database names make the code less portable. If you need to deploy the same code to multiple environments (e.g., development, testing, production), each with a different database name, you would need to modify the code each time, increasing maintenance overhead.

Additionally, hardcoding database names can potentially expose sensitive information about your database structure, making it easier for attackers to target your system.

Noncompliant code example

SELECT
  sale_id
 ,name_name
FROM shop_db.dbo.sales;
GO

Compliant solution

SELECT
  sale_id
 ,name_name
FROM dbo.sales;
GO

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Studio for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Studio in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Studio for your business, request a demo to see it in action.
Ready to start using dbForge Studio for SQL Server?