Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Union query is dropping leading zeros...

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
0
0
US
I have a tavle with a field that is numeric 12 length with some leading zeros. I have an item with a value in the table 009945973000.

I have another table where the same named field is text.
I create a UNION query to "glue" the two tables.
(these come in as spread sheets).

When I run the UNION query, the value shows as 9945973000 its dropping the leading zeros. How can I solve this.
I need the full value.
 



Hi,

Numbers (NUMERIC fields) do not have leading zeros.

Character fields do. Use the Format function to convert your numbers to a string of whatever length you desire.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 



FYI, faq68-6659

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi
Thanks for getting back. Where would I do this,,,,an update query or in the table designer.
 


Is your "number" a value that you do arithmetic on, or is it just an identifier, like an Employeed id or Invoice id?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Its an identifier. I got it, In the UNION query I used SELECT FORMAT([FIELD],"000000000000") and it worked.

Thanks much, I appreciate ....
 

your identifier fields really ought to be TEXT rather than a numeric type.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top