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
 General SQL Server Forums
 New to SQL Server Programming
 identity columns not flagged in INFO_SCHEMA.column

Author  Topic 

cuskit
Starting Member

2 Posts

Posted - 2006-11-09 : 07:14:24
Morning...

I've attempted several searches to find my answer but they're not quite the answer Im looking for.

We have a large VB6 system that currently sits on an informix database and I've been given the task of shifting it
onto SQL Server (Note: with as little impact to the code as possible - runtime speed will not be an issue at this early stage)

To cut a long story short, I'm hoping to find where relevent columns are shown as being an identity column.

I expected to see it in INFORMATION_SCHEMA.columns but its not in there (at least not that I can see)


Anyone point me in the right direction?


Cheers
Aaron.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-09 : 07:36:19
[code]
use northwind
SELECT COLUMNPROPERTY( OBJECT_ID(table_name), column_name, 'IsIdentity') AS 'Is Identity', *
FROM information_schema.columns
where table_name = 'Orders'
[/code]



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-11-09 : 07:40:07
use the status column from syscolumns

from BOL on syscolumns
quote:

Bitmap used to describe a property of the column or the parameter:
0x08 = Column allows null values.
0x10 = ANSI padding was in effect when varchar or varbinary columns were added. Trailing blanks are preserved for varchar and trailing zeros are preserved for varbinary columns.
0x40 = Parameter is an OUTPUT parameter.
0x80 = Column is an identity column.




KH

Go to Top of Page

cuskit
Starting Member

2 Posts

Posted - 2006-11-09 : 07:48:18
@spirit1
Thanks mate... Works like a charm!

@Khtan
Thanks also.. I will keep it in mind for when I need to start performance testing - and use whichever is the faster.

Cheers
Aaron.
Go to Top of Page
   

- Advertisement -