Home All Groups Group Topic Archive Search About
Author
23 Jun 2006 8:07 PM
Taha
[Message not available]

Author
23 Jun 2006 8:25 PM
Greg Larsen
Here is an article I wrote about this that might help:

http://www.databasejournal.com/features/mssql/article.php/2244821


Show quote
"Taha" wrote:

> Hi All
>
> How Can I Select From Table With IDENTITY For Row Count
> The Table Has No IDENTITY Column
>
> Select Col1,IDENTITY As Col2  From My Table
>
> Col1    Col2
> A        1
> B        2
> C        3
> D        4
> ...        ..
>
> Thanks
>
>
>
>
>
>
>
Author
23 Jun 2006 8:31 PM
Taha
OK

Thank You Greg Larsen
Show quote
"Greg Larsen" <GregLar***@discussions.microsoft.com> wrote in message
news:CE2DF0A4-859B-465F-A55F-B4630F8917A7@microsoft.com...
> Here is an article I wrote about this that might help:
>
> http://www.databasejournal.com/features/mssql/article.php/2244821
>
>
> "Taha" wrote:
>
>> Hi All
>>
>> How Can I Select From Table With IDENTITY For Row Count
>> The Table Has No IDENTITY Column
>>
>> Select Col1,IDENTITY As Col2  From My Table
>>
>> Col1    Col2
>> A        1
>> B        2
>> C        3
>> D        4
>> ...        ..
>>
>> Thanks
>>
>>
>>
>>
>>
>>
>>
Author
23 Jun 2006 8:32 PM
Aaron Bertrand [SQL Server MVP]
I have an article too.  Not to compete with Greg, in fact I'm sure they're
similar.  Just posting for completeness.
http://www.aspfaq.com/2427





Show quote
"Taha" <taha***@hotmail.com> wrote in message
news:OeRTdCwlGHA.4772@TK2MSFTNGP04.phx.gbl...
> Hi All
>
> How Can I Select From Table With IDENTITY For Row Count
> The Table Has No IDENTITY Column
>
> Select Col1,IDENTITY As Col2  From My Table
>
> Col1    Col2
> A        1
> B        2
> C        3
> D        4
> ..        ..
>
> Thanks
>
>
>
>
>
>
Author
23 Jun 2006 8:48 PM
Alexander Kuznetsov
if you are on SS 2005, use row_number()
Author
24 Jun 2006 6:13 AM
MYBESTFUTURE FUTURE
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.developersdex.com ***
Author
24 Jun 2006 11:57 AM
Dan Guzman
> 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

Show quote
"MYBESTFUTURE FUTURE" <mybestfut***@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.developersdex.com ***

AddThis Social Bookmark Button