Home All Groups Group Topic Archive Search About

How to get the Table Name from the ID column in syscolumns

Author
15 Jul 2005 6:19 PM
Mator DeSchenna
select ID from syscolumns

how do I find out what the table name is based on ID?
thanks

Author
15 Jul 2005 6:22 PM
Aaron Bertrand [SQL Server MVP]
SELECT OBJECT_NAME(id) FROM syscolumns


However, a better place to retrieve this information is
INFORMATION_SCHEMA.COLUMNS





Show quote
"Mator DeSchenna" <ddsdd*sdadf.com> wrote in message
news:zOOdnYkgJsShY0rfRVn-iw@comcast.com...
> select ID from syscolumns
>
> how do I find out what the table name is based on ID?
> thanks
>
Author
15 Jul 2005 6:24 PM
JT
The function object_id( object_id ) will return the name for any type of
object id (tables, SPs, etc.).

Show quote
"Mator DeSchenna" <ddsdd*sdadf.com> wrote in message
news:zOOdnYkgJsShY0rfRVn-iw@comcast.com...
> select ID from syscolumns
>
> how do I find out what the table name is based on ID?
> thanks
>
Author
15 Jul 2005 7:02 PM
Mator DeSchenna
Thank you
Author
15 Jul 2005 7:23 PM
JT
but I meant to say.. object_name( object_id )

Show quote
"Mator DeSchenna" <ddsdd*sdadf.com> wrote in message
news:WoadnZKg3eLelUXfRVn-2A@comcast.com...
> Thank you
>
>
>
Author
17 Jul 2005 6:16 AM
Mator DeSchenna
Yes you certainly did

Show quote
"JT" <some***@microsoft.com> wrote in message
news:OLb4UMXiFHA.1412@TK2MSFTNGP10.phx.gbl...
> but I meant to say.. object_name( object_id )
>
> "Mator DeSchenna" <ddsdd*sdadf.com> wrote in message
> news:WoadnZKg3eLelUXfRVn-2A@comcast.com...
>> Thank you
>>
>>
>>
>
>

AddThis Social Bookmark Button