Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 IDENTITY creation using two values

Author  Topic 

mayewil
Starting Member

1 Post

Posted - 2008-03-28 : 12:40:31
Going from Oracle to SQL 2000 and want to repeat Oracle process whereby the job_id field is generated using a trigger and a sequence one-up generator. These two values are then combined to create the job_id number. The sequence is simple: a minvalue, maxvalue and increment 1. The trigger is generating the first five characters from yyddd and appending the next sequence value to it.
Example:
JOB_ID: 08088155
YY: (Year = 08)
DDD: (88th day of year)
Next sequence number: (155)

When I create the table in SQL 2000 I will identify the JOB_ID column as an IDENTITY type data field, but is there any way to duplicate this Oracle sequence in SQL?

Any help will be greatly appreciated.

Bill

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-03-29 : 00:28:22
You can use identity column for sequence number then build job_id with datepart function and that column.
Go to Top of Page
   

- Advertisement -