DB_NAME
Description
This function returns the name of a specified database.(DB_NAME in Transact-SQL).
Sample Source Pattern
Syntax
DB_NAME ( [ database_id ] ) CURRENT_DATABASE() /*** SSC-FDM-TS0010 - CURRENT_DATABASE function has different behavior in certain cases ***/Examples
Code:
SELECT DB_NAME();Result:
RESULT |
-------------------+
ADVENTUREWORKS2019 |Code:
SELECT
CURRENT_DATABASE() /*** SSC-FDM-TS0010 - CURRENT_DATABASE function has different behavior in certain cases ***/;Result:
RESULT |
-------------------+
ADVENTUREWORKS2019 |Known issues
1. CURRENT_DATABASE function has different behavior in certain cases
DB_NAME function can be invoked with the database_id parameter, which returns the name of the specified database. Without parameters, the function returns the current database name. However, SnowFlake does not support this parameter and the CURRENT_DATABASE function will always return the current database name.
Related EWIs
SSC-FDM-TS0010: CURRENT_DATABASE function has different behavior in certain cases.
Last updated