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 ] )  

Examples

Code:

SELECT DB_NAME();

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.

  • MSCEWI4069: CURRENT_DATABASE function has different behavior in certain cases

Last updated