We help IT Professionals succeed at work.
Get Started

Batch update of sequential numbers within customers

309 Views
Last Modified: 2012-05-09
Hi Experts,

I want to use an insert statement to add a number of rows of data to a table. The Primary key is the CustomerID and Seqn fields. The seqn field is a simple incrementing number for each customer (starting from 1).

What sort of T-SQL is needed to use with an insert statement to start the number from the next available integer when appending records? As I could be adding for multiple customers and the  next seqn for each may well be different.

Thanks


Kelvin
Comment
Watch Question
Senior DBA
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This problem has been solved!
Unlock 1 Answer and 14 Comments.
See Answer
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:

  • Troubleshooting
  • Research
  • Professional Opinions
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