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 133431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:25:52+00:00 2026-05-11T06:25:52+00:00

We have a large database with enquiries, each enquirys is referenced using a Guid.

  • 0

We have a large database with enquiries, each enquirys is referenced using a Guid. The Guid isn’t very customer friendly so we want to the additional 5 digit ‘human id’ (ok as we’ll very likely won’t have more than 99999 enquirys active at any time, and it’s ok if a humanuid reference multiple enquirys as they aren’t used for anything important).

1) Is there any way to have a IDENTITY column reset to 1 after 99999?

My current workaround to this is to use a INT IDENTITY(1,1) NOT NULL column and when presenting a HumanId take HumanId % 100000.

2) Is there any way to automatically ‘randomly distribute’ the ids over [0..99999] so that two enquirys created after each other don’t get the adjacent ids? I guess I’m looking for a two-way one-to-one hash function??

… Ideally I’d like to create this using T-SQL automatically creating these id’s when a enquiry is created.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T06:25:53+00:00Added an answer on May 11, 2026 at 6:25 am

    If you absolutely need to do this in the database, then why not derive your human-friendly value directly from the GUID column?

    -- human_id doesn't have to be calculated when you retrieve the data -- you could create a computed column on the table itself if you prefer SELECT (CAST(your_guid_column AS BINARY(3)) % 100000) AS human_id FROM your_table 

    This will give you a random-ish value between 0 and 99999, derived from the first 3 bytes of the GUID. If you want a larger, or smaller, range then adjust the divisor accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large database of normalized order data that is becoming very slow
I have a large database and would like to select table names that have
I have a large database of users (~200,000) that I'm transferring from a ASP.NET
I have to dump a large database over a network pipe that doesn't have
I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints.
I have a database table with a large number of rows and one numeric
I have large data sets (10 Hz data, so 864k points per 24 Hours)
I have large batches of XHTML files that are manually updated. During the review
I'm developing a website in PHP and I have large JS files that I
I have several databases where the transaction log (.LDF) is many times larger than

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.