always on

Technical Article

RE: Query to get first number

  • Reply

How about this: DECLARE @NewBudgetID INT IF (Select Min(BudgetID) as NewBudgetID from tblBudgetYear) > 1 Set @NewBudgetID = 1 ELSE Select @NewBudgetID = top 1 BudgetID + 1 from tblBudgetYear x where not exists(Select NULL from tblBudgetYear where BudgetID = x.BudgetID + 1) order by BudgetID On the occaisions where the value 1 is available, […]

2003-08-31

1 reads

Technical Article

RE: Query to get first number

  • Reply

OK Identity does not reuse. Should it ? Depends on the requirements. If your id column reaches the maximum value (int/bigint !!), you're in big troubles anyway and probably you'll have to adjust you id-producing algorithm. With Identity you could checkident and go on. Besides it one should never deduct anything from an id (low […]

2003-08-29

1 reads

Blogs

Real-World SQL Mastery: Your Hands-On, Mess-Free Sandbox

By

Are you ready to take your SQL skills from theoretical to tactical? If you've...

Set a Runtime Variable in an Azure DevOps Pipeline

By

Note: I DO NOT recommend this. Any changes to a pipeline should be in...

A New Word: Symptomania

By

symptomania – n. the fantasy that there’s some elaborate diagnosis out there that neatly...

Read the latest Blogs

Forums

7 sept, scheduled book

By philip.scott

Comments posted to this topic are about the item 7 sept, scheduled book

7 sept, schedlued article

By philip.scott

Comments posted to this topic are about the item 7 sept, schedlued article

6 sept, published book

By philip.scott

Comments posted to this topic are about the item 6 sept, published book

Visit the forum

Question of the Day

Azure Data Lake Storage Gen 2

Azure Data Lake Storage Gen 2 is built on ...?

See possible answers