Creating Auto Number field with preceding number of 0's?
Without getting into a technical argument, once you start getting fussy about the display of a number, it is no longer just a number. (Mathematically, we refer to a number as its value, while its display is referred to a numeral).

Why is this important? What you are asking for is not actually a number, but some way of displaying it. The short answer is that you will need to convert it to a string.

If you want to zero-pad a number, you use a combination of string operations:


::char will convert a value to a string
lpad(string,length,padding) will left-pad a string with the given padding.


Combining the two you get:

select lpad(id::char,4,'0'), …
from …;


where id is presumed to be your auto-numbered column.