Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SQL Server 2008: Auto increment column

Avatar of AWestEng
AWestEngFlag for Sweden asked on
Microsoft SQL Server 2008
8 Comments1 Solution1028 ViewsLast Modified:

I need some help how to increment a column (RevisionNumber) depending of ProductType.

So if I have [ProductType] 10 and 20 both with [RevisionNumber]  1, if I then I insert a new ProductType 10, then I like RevisionNumber to be 2, and the next time I insert a new ProductType 20 I like that RevisionNumber also to be 2, (not 3 if you use default Auto Increment)

So I only want to increment  [RevisionNumber] with +1 from the number it already has, so if it has 4 I like it to be 5 regarding of what the Auto Increment has done on another product type.

Is this possible?