SSC-FDM-TS0025

DB_ID_UDF may have a different behavior in certain cases.

Description

This FDM is added to clarify that the DB_ID_UDF tries to emulate the DB_ID SqlServer function as well as possible. In SqlServer, the identifier assigned to a database is unique, and if the database is deleted, this ID won't ever be used again; otherwise, in Snowflake, this identifier corresponds to the number assigned to the database when it is created; it is also unique, but it is a consecutive number which means that if this database is deleted, this number is going to be assigned to the database that was created after the deleted one.

Input Code:

IN -> SqlServer_01.sql
SELECT DB_ID('my_database');

Output Code:

OUT -> SqlServer_01.sql
SELECT
DB_ID_UDF('my_database') /*** SSC-FDM-TS0025 - DB_ID_UDF MAY HAVE A DIFFERENT BEHAVIOR IN CERTAIN CASES ***/;

Recommendations

Last updated