Monday, March 19, 2012

IDENTITY SELECT

if you are on SS 2005, use row_number()
Hi,
I have one table with IDENTITY column,
how can i get the name of that identity column using query?
is it possible, create a table with more than one identity column?
*** Sent via Developersdex http://www.examnotes.net ***|||> how can i get the name of that identity column using query?
One method:
SELECT name
FROM syscolumns
WHERE
id = OBJECT_ID(N'dbo.MyTable')
AND COLUMNPROPERTY(id, name, 'IsIdentity') = 1

> is it possible, create a table with more than one identity column?
No, but why would you need to do this?
BTW, it's probably better to start a new thread since your questions are off
topic of this one.
Hope this helps.
Dan Guzman
SQL Server MVP
"MYBESTFUTURE FUTURE" <mybestfuture@.rediffmail.com> wrote in message
news:%237y9NV1lGHA.856@.TK2MSFTNGP03.phx.gbl...
>
> Hi,
> I have one table with IDENTITY column,
> how can i get the name of that identity column using query?
> is it possible, create a table with more than one identity column?
> *** Sent via Developersdex http://www.examnotes.net ***

No comments:

Post a Comment