Skip to content

DB_NAME(@dbID) returns Null #268

@ChristopherElliott

Description

@ChristopherElliott

In my example sys.Databases lists my database_id as 6 but if I query DB_ID() it returns 5. The script uses database_id applied to DB_NAME and it returns null in my case. Googling is suggesting that this ID can't be relied upon and that the db name should be used instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions