Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6052063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:53:10+00:00 2026-05-23T07:53:10+00:00

I have a simple table with tax rates SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER

  • 0

I have a simple table with tax rates

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[TaxRates](
    [Id] [bigint] IDENTITY(1,1) NOT NULL,
    [Name] [nvarchar](50) NULL,
 CONSTRAINT [PK_TaxRates] PRIMARY KEY CLUSTERED 
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

If user deleted record I want to not change autoincrementer while next insert.

To have more clearance.

Now I have 3 records with id 0,1 and 2. When I delete row with Id 2 and some time later I add next tax rate I want to have records in this table like before 0,1,2.
There shouldn’t be chance to have a gap like 0,1,2,4,6. It must be trigger.

Could you help with that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:53:11+00:00Added an answer on May 23, 2026 at 7:53 am

    You need to accept gaps or don’t use IDENTITY

    1. id should have no external meaning
    2. You can’t update IDENTITY values
    3. IDENTITY columns will always have gaps
    4. In this case you’d update the clustered Pk which will be expensive
    5. What about foreign keys? you’d need a CASCADE
    6. Contiguous numbers can be generated with ROW_NUMBER() at read time
    7. Without IDENTITY (whether you load this table or another) won’t be concurrency-safe under load
    8. Trying to INSERT into a gap (by an INSTEAD OF trigger) won’t be concurrency-safe under load
    9. (Edit) History tables may have the deleted values anyway
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple table CREATE TABLE a( id int IDENTITY(1,1) NOT NULL, x
I have a simple table: CREATE TABLE [dbo].[Users]([Surname] [nvarchar](50) COLLATE Latin1_General_CI_AI NULL) ON [PRIMARY]
I have a simple table as below. CREATE TABLE `stats` ( `id` int(11) NOT
I have simple table creating script in Postgres 9.1. I need it to create
I have a simple table in Sybase, let's say it looks as follows: CREATE
I have a simple table not related to any other. It has a not
I have a simple table, where I have set IDs for headers and IDs
I have a simple table like this: CREATE TABLE `users` ( `id` int(11) unsigned
I have a simple table with autoincrementing ID's and one text column. id(int), value(nvarchar)
I have a simple table view which is editable. All I need the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.