By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,572 Members | 1,516 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,572 IT Pros & Developers. It's quick & easy.

Identity Column (SQL server)

P: n/a
I know this question should be posted in a SQL server newsgroup, but I can't
find one. That's ok... it's understand that any VB.NET programmer is also an
expert on SQL, right? :-)

Anyway, I need to be able to figure out if a column in a table is an
IDENTITY column. Any one know how to do this?

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I figured it out and wrote a UDF, if anyone ever needs this too:

CREATE FUNCTION IdentityColumn(@TableName varchar(255))
RETURNS varchar(255) AS
Return IsNull (
(Select C.Name From syscolumns C inner join sysobjects T on T.ID = C.ID
Where T.Name = @TableName and C.ColStat & 1 = 1)
, ''
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.