Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INFORMATION_SCHEMA question
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00676242
Message ID:
00676292
Views:
14
If you know table and column name than you don't need INFORMATION_SCHEMA.
SELECT COLUMNPROPERTY(OBJECT_ID('mytable'), 'TransactionDetailsID', 'IsIdentity')
>Thanks Sergey,
>
>I modified it a bit as follows:
>
>
>SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
>	WHERE (COLUMNPROPERTY(OBJECT_ID(table_name), column_name, 'IsIdentity') > 0)
>	and (COLUMN_NAME = 'TransactionDetailsID')
>
>
>If it returns 1, then the column is an identity column.
>
>
>>Try
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
>>	WHERE COLUMNPROPERTY(OBJECT_ID(table_name), column_name, 'IsIdentity') > 0
>>
>>
>>>I need to query either an INFORMATION_SCHEMA view or system table to determine if a field in a table is an identity field.
>>>
>>>
>>>INFORMATION_SCHEMA.COLUMNS doesn't seem to be the answer (unless I'm reading it wrong...).
>>>
>>>Does anyone know if this information can be obtained from a INFORMATION_SCHEMA view?
>>>
>>>If not, how should I go about obtaining this information?
>>>
>>>Thanks in advance, Al
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform