tigertoolbox icon indicating copy to clipboard operation
tigertoolbox copied to clipboard

DB_NAME(@dbID) returns Null

Open ChristopherElliott opened this issue 3 years ago • 1 comments

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.

ChristopherElliott avatar Apr 20 '22 16:04 ChristopherElliott

Proposed a fix that seems to work for my case: https://github.com/microsoft/tigertoolbox/pull/269

ChristopherElliott avatar Apr 23 '22 01:04 ChristopherElliott