Generating ID values
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   satyendra_adhikari
Posted On:   Sunday, February 17, 2002 10:43 PM

hello!!
i need to know how can i generating ID field value for database just at the
time of inserting a new record.
my ID's are like CD0001,CD0002..

if someone could provide a solution for use with SQL server ..it will be of great help..
as there is no pseudo column like ROWID as in oracle..

i had been using rowid before for generating values..
thankx

regards

Re: Generating ID values

Posted By:   Anonymous  
Posted On:   Monday, February 18, 2002 12:50 AM

Well, there are a number of paths that you can go down to solve this problem. The quickest way, and the one most likely to make any DBAs happy is to use a seperate table that will serve as a counter for the numeric portion of your id. the key is not to use IDENTITY columns since they are prone to "gaps" that are a pain to fix. With a sequence number table, you can fix the sequencing very easily should anything go wrong.
About | Sitemap | Contact