vbnetcoder
asked on
generating a key field
for a key in my table I am appending RACT to a number..
So the key would be like this:
RACT100000000000000000000
I would like the next id to be:
RACT100000000000000000001
etc
Is there something in the table create that I could make that happen so that they keep adding one each time? Or is there a better way to do in in my t-sql code where I am inserting?
So the key would be like this:
RACT100000000000000000000
I would like the next id to be:
RACT100000000000000000001
etc
Is there something in the table create that I could make that happen so that they keep adding one each time? Or is there a better way to do in in my t-sql code where I am inserting?
Use separate columns in the table for the 'RACT' value and the number. Then you can use IDENTITY or a SEQUENCE to supply values to the number. Use a concatenated column to return combined values to queries. You can use a view or a computed column to combine the values.
ASKER
How would I do it if I wrote in my T-SQL code?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
ty