The topic describes the DF028 T-SQL code analysis rule.
EXECUTION RULES
Hardcoded database name is used.
Do not use hardcoded database names to avoid portability and/or deployment issues.
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.
SELECT
sale_id
,name_name
FROM shop_db.dbo.sales;
GO
SELECT
sale_id
,name_name
FROM dbo.sales;
GO