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.
| Author |
Topic |
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2009-03-17 : 02:46:14
|
| Hello all,I have an application which has Organization Code which is varchar and a branch code which is child of Organization.Now I have to generate these codes dynamically.I have created a Table which will have values like given belowCODE_TYPE START_VALUE ORG 01 BRN 01 I want that when Organization is generated first time , its code will be 01, and on every add it will be incremented by oneand when Branch is generated first time for an organization, it should be started by 0101,0102,0103.....0109,0201.Can any one tell me that what table structure should be used to do this.Note: I want to make my auto generated number atomic, so that one auto generted code should not be assigned to another Branch.Thanks in advance |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-03-17 : 03:09:13
|
| see this link it may usefulhttp://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server |
 |
|
|
|
|
|