Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sql system table information

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-04 : 08:14:19
Nandkishor writes "I want to firnd out the name of the tables who have identity column by using sysobjets table.
First I found that the most tables with the identity column have value fo 2049 in category column of
sysobjects and in the syscolumns the autoval column has a varbinary value for that columns
I created the table with a column as identity. For this table I forund that category column in sysbjects
table has value 1. so I get confused . we can find the out the name of table using syscolumn to sysobject
i.e

select name from sysobjects where id in(select id from syscolumns where autoval is not null)

so as above the subquery will return the id of the tables with autoval column not null and we can get the
name from sysobjects table to respective id.

But I want to know that Is there any column in the sysobjects which gives the info. directly that
this table has identity column.
I can not get the information of the columns of the sysobjects table from books online provided by
microsoft with sql kit
so please help me to solve the problem"

Nazim
A custom title

1408 Posts

Posted - 2002-06-04 : 09:01:21

select name from syscolumns
where autoval is not null


remember, Querying system tables directly isnt recommended, coz they can change in future release.



--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -