question

Ian Ringrose avatar image
Ian Ringrose asked

How do I port a SqlServer application that uses IDENTITY columns to oracle?

I do not wish to have to change the application code if possible. The current data access in done with Ado.net mostly Datasets and table adaptors.

Most (all) of the current sql statements in the application are simple enough to work on both oracle and sqlserver with no changes. (apart from a string.replace() to convert @ in parameter names)

sql-serverdeveloperportidentity-column
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Jonah H. Harris avatar image
Jonah H. Harris answered

In Oracle, you create a number column and use a sequence. A good reference for you would likely be Oracle for SQL Server Developers, Vol. 4: Identity Columns & Sequences.

2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Do I then need to change my applicaion code so it makes use of a Sequence?
0 Likes 0 ·
The sequence can be incremented via a BEFORE INSERT trigger (which you would have to write). It depends on what your application did with the identity column. Many times, you don't need to change the app code to handle that difference though.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.