July 11, 2007 at 2:48 pm
is there a way to get the actual object name using the object_id?
i'm looking for a way i can sort of extrapolate the object name
using the object_id. maybe a quick function?
hope it's a quick one liner.
thanks in advance.
_________________________
July 11, 2007 at 2:52 pm
Try the object_name() function... 😉
SELECT object_name(12345)
July 12, 2007 at 8:47 am
so just as a test... i'll run a query against sysobjects with only
the name and id.
select name, id from master..sysobjects
i can then get the id to appear just as the object name using the object_name
function right?
so how would i put the object_name function into the select statement?
i think just a quick example would point me in the right direction.
sorry if this is sort of a fundamental question, but just to clear
things up a bit.
thanks
_________________________
July 12, 2007 at 10:57 am
Assuming I have a table named userobj that contains object IDs and a user ID:
create table userobj
(userid int,
objid int
)
select
userid, object_name(901578250)
from userobj
I select user ID from userobj and the object_name function gets the name of the object from sysobjects.
Greg
Greg
July 12, 2007 at 12:38 pm
thanks for the example! i see whats happening now.
i can see how it gets the name using each object id i
have in the parens, but i guess there's no way to do
it otherwise? like a table with 100 object id's. i
would need to write the query first with each id in
the parens ().
you answered my question though. thanks
_________________________
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply