Mani-584606
SSChampion
Points: 11788
More actions
March 21, 2008 at 7:39 am
#122718
I run the trace in profiler,by seeing the trace results ,How to go to a particular database by knowing the dbid? and how to go to a particular table by knowing the objectid or spid?
thanx
Adam Bean
One Orange Chip
Points: 26631
March 21, 2008 at 7:43 am
#792444
SELECT DB_NAME(dbid)
SELECT OBJECT_NAME(objectid, dbid)
Adam Haines
SSC-Insane
Points: 23217
March 21, 2008 at 7:54 am
#792452
SELECT DB_ID('MyDbName')
March 21, 2008 at 7:55 am
#792453
I actually read the post wrong. You code above gives you the dbid for a database name. Not vice-versa.
You should use SELECT DB_Name(MyDbId), which Adam Bean already posted.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply