DB_NAME(@dbID) returns Null

Open
#268 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
sql
Domain
databases

Research direction

Start by locating the script that applies the sys.Databases database_id to DB_NAME, then compare its behavior with DB_ID() and the database name. Verify the change against the reported case where the database_id values differ and DB_NAME(@dbID) returns NULL.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Jupyter Notebook
Stars
1.6k
Forks
749
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/tigertoolbox

All issues in microsoft/tigertoolbox

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.