Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Using Sequences like the IdentityColumn in SQL server
On 21 Nov 2001 17:21:28 -0800, jmurdock_at_dialoguewizard.com (Sandy
Murdock) wrote:
>I am not a database newbie - but I am very much an Oracle newbie.
>
>So, that in mind...
>
>With SQL server there is no Sequence, there is a data-type called
>Identity, which works like a sequence for each table. You don't Insert
>that field, it just auto increments (It is an Integer).
>
>So:
>
>Insert into Users(FirstName, LastName)
>Values ('Sandy', 'Murdock')
>
>Could actually insert:
>
>UserID 4544 (the Identity Column)
>firstName = Sandy
>LastName = Murdock
>
>You don't tell it to insert the unique value, it just does.
>
>If you want to know the value of the Identity Column you just inserted
>you can type:
>
>select @@Identity
>
>in your stored procedure, so you could type:
>
>select @UserID = @@Identity
>
>after inserting a row in a User table, and the variable @UserID would
>be equal to the Identity you just inserted.
>
>With a sequence in a stored procedure, how can equate the
>sequence.currval to a variable??
>
>I want to use the value in the where clause of a Statement, which you
>cannot??? do with the sequence.currval.
>
>Any suggestions????
>
>Believe it or not I really DO know what I am doing with MS SQL server
>;)
>
>Thank you.
Amen to this. Now you should learn to read Oracle manual and learn to
use FAQ resources, like newsgroup archives at http://groups.google.com
or
http://www.jlcomp.demon.co.uk/faq/autonumb.html
Hth
Sybrand Bakker, Senior Oracle DBA
To reply remove -verwijderdit from my e-mail address Received on Wed Nov 21 2001 - 23:18:26 CST
![]() |
![]() |