Click or drag to resize

SA0253 : The current database is hardcoded in object reference

The topic describes the SA0253 analysis rule.

Message

The current database is hardcoded in object reference

Description

The rule looks inside SELECT, UPDATE, DELETE, INSERT, MERGE and EXECUTE statements for object qualified with current database.

Avoid four part identifier names with hardcoded references to the current database.

This way using hardcoded current database name, could later cause maintainability problems as for example if the code is used in another database or the database name is changed.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule requires Analysis Context. If context is missing, the rule will be skipped during analysis.

Categories

Design Rules, New Rules

Additional Information

There is no additional info for this rule.

Example Test Script
SQL
1EXECUTE database1.schema1.proc1
2EXECUTE adventureWorks2008r2_test.schema1.proc1

Analysis Results

 MessageLineColumn
1SA0253 : The current database is hardcoded in object reference.28
See Also

Other Resources