I have a table with an Identity column which provides my ticketNumber.
I want another table to provide a ticketStepNumber. A ticket may have 0 or more steps, so I won't always be creating a ticketStepNumber.
The ticketStepNumber value is a combination of the ticketNumber column (int) and the stepNumber column (int). I'd like to define the stepNumber column like an identity but starting at 1 for each value of the ticketNumber column, so all I have to do in my stored procedure is pass in a ticketNumber and I'll get the new stepNumber. E.g.
ticketNumber stepNumber
1 1
2 1
2 2
2 3
4 1
7 1
7 2
Is there a way to define this in the table definition or do I have to do it in the SP?