Avatar of engayman01

asked on 

Auto Increment in MS SQL

I have two columns 'serial' and  'type' in table 'bills'
I want to get the max serial +1 where type = x
the standard statement:

"SELECT ISNULL(MAX(serial), 0) + 1 FROM bills
WHERE type = x"

take a huge response time if there is a huge number of records.

Is there any better idea?
Microsoft SQL Server 2005Microsoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon