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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:45:59+00:00 2026-06-03T18:45:59+00:00

would it be possible to set an int value to begin with a zero?

  • 0

would it be possible to set an int value to begin with a zero? example would be like an ID number which would be 0020192 but it only saves it as 20192, i guess it would be possible to set it as a string related type but if possible let it remain as Int.

the 00 would be required cause the first 3 digits(002) denote an employee work section while the last 4 would be the employee’s actual number(0192, the 192nd employee)

  • 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-06-03T18:46:02+00:00Added an answer on June 3, 2026 at 6:46 pm

    In your comment you say this:

    actually it would be a seven digit id. 0090001, the first three digits (009) would identify the workstation of an employee while the last 4 digits(0014) would be his actual employee id.

    That says that your IDs aren’t actually numbers at all, they’re strings with a specific internal structure:

    1. Seven characters long.
    2. All characters are digits.
    3. The first three characters identify a workstation.
    4. The last four characters identify an employee.

    That’s a string that just happens to look like a number. You should use a char(7) for this and add a CHECK constraint to enforce the internal format (or as much of it as you can get away with).

    I also don’t see much chance of doing any arithmetic or other number-ish things with these IDs, mostly because they are not, in fact, numbers.

    A happy side effect of using char(7) for this is that your application should treat the IDs as strings and you won’t have to worry about something getting confused and thinking that 0112222 is an octal number.

    If possible you should use two separate string columns:

    1. A char(3) for the workstation ID.
    2. And a char(4) for the employee ID.

    If you have these two objects elsewhere in your database using numeric IDs then use two numbers here as well and add foreign keys to constraint your data.

    Executive summary: Your IDs are not numbers so don’t try to store them as numbers, they’re strings that look like numbers and should be stored and manipulated as strings.

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

Sidebar

Related Questions

Given the example queries below (Simplified examples only) DECLARE @DT int; SET @DT=20110717; --
Possible Duplicates: How would you set a variable to the largest number possible in
I would like to know if in SQL is it possible to return a
I have a table where a int column should either be set to zero
I have this jquery plugin that zooms in on photos, but I would like
I would like to pass a value to the ctor of a DbContext and
I would like to search an entire MS SQL 2000 database for one value.
I would like to know if in SQL is it possible to return a
Possible Duplicate: C/C++ check if one bit is set in, i.e. int variable e.g.
I would like to know if it's possible to init a subclass of NSManagedObject

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.