Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using an AutoIncrement coumn as part of a multi column primary key

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
0
0
US
Hello all,

I have an MDI application which needs to track historisity so a user can go back and select a prior point. I would like to implement this as a multicolumn key with the high order part a Guid (column ID) and the low order part an autoincrement integer (column Revision#). That way I can let Sql Server handle the increments.

My question is this, is there a way to do this in the context of a multicolumn primary key? What I would want to have happen is for the Revision# column to be set/reset to 0 whenever the ID column changes.

Is there a better way? Any ideas and/or suggestions would be greatly appreciated!

Have a great day!

j2consulting@yahoo.com
 
You would not be able to use an Identity column in this case. You will have to use a trigger or stored procedure to check if the ID has changed and then increment and set the value manually.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top