View Full Version : removing leading zeros


phamyh
08-13-2009, 09:50 AM
How to I do a query to match numbers but exclude the leading zeros?

I have 2 tables that i'm doing an equal join to. The 2nd table has leading zero to the numbers so it's making it difficult for me to find any matches.

ex

table 1 table 2
12345 012345

But not all numbers on these columns have a leading zero so I can't do a trim. What should i do?

Thanks!

pbaldy
08-13-2009, 09:52 AM
You could try adding CLng() around both fields in the join.

phamyh
08-13-2009, 10:29 AM
Thank you!! This forum has always been a great resource for me!!