JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Okay,
This will be an odd question.
In The Table
Item_ID PK
ItemOwn_ID PK
Then in a View I would have:
ItemOwnID + '-' + Format('00000', Item_ID) as RecordID
(Okay i know that isn't the right syntax, but I know somewhere in there there is a way to Format at Integer number so that it is exactly "x" digits wide, and can be padded with 0's or spaces, etc, so please ignore the pseudo code and understand the idea of what the field is "supposed" to look like)
Now what I'd like is for Item_ID to be an Auto-Incremented field (starting at 1 and going up 1 each new record Much like an Identity Field)
HOWEVER (and this is the important part):
I want that Auto Increment Field to Reset (or perhaps be partitioned) "around" the ItemOwn_ID field.
So Example:
AddNewRow -
ItemOwn_ID = "100" //user Entered
ItemID = 1
AddNewRow -
ItemOwn_ID = "100" //user entered
ItemID = 2
... etc ...
AddNewRow -
ItemOwn_ID = "106" //User entered
ItemID = 1
Like that.
(Yes, I can do this with back end programming in my VB.net application, but I was wondering if there is a way I can set up a table to do this automatically)
Thanks
This will be an odd question.
In The Table
Item_ID PK
ItemOwn_ID PK
Then in a View I would have:
ItemOwnID + '-' + Format('00000', Item_ID) as RecordID
(Okay i know that isn't the right syntax, but I know somewhere in there there is a way to Format at Integer number so that it is exactly "x" digits wide, and can be padded with 0's or spaces, etc, so please ignore the pseudo code and understand the idea of what the field is "supposed" to look like)
Now what I'd like is for Item_ID to be an Auto-Incremented field (starting at 1 and going up 1 each new record Much like an Identity Field)
HOWEVER (and this is the important part):
I want that Auto Increment Field to Reset (or perhaps be partitioned) "around" the ItemOwn_ID field.
So Example:
AddNewRow -
ItemOwn_ID = "100" //user Entered
ItemID = 1
AddNewRow -
ItemOwn_ID = "100" //user entered
ItemID = 2
... etc ...
AddNewRow -
ItemOwn_ID = "106" //User entered
ItemID = 1
Like that.
(Yes, I can do this with back end programming in my VB.net application, but I was wondering if there is a way I can set up a table to do this automatically)
Thanks