DB_NAME

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Applies to

Description

This function returns the name of a specified database.(DB_NAME in Transact-SQL).

Sample Source Pattern

Syntax

IN -> SqlServer_01.sql
DB_NAME ( [ database_id ] )  

Examples

Code:

IN -> SqlServer_02.sql
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.

  1. SSC-FDM-TS0010: CURRENT_DATABASE function has different behavior in certain cases.

Last updated