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)
In your comment you say this:
That says that your IDs aren’t actually numbers at all, they’re strings with a specific internal structure:
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 that0112222is an octal number.If possible you should use two separate string columns:
char(3)for the workstation ID.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.