Need a little database help

DnetMHZ

Diamond Member
Apr 10, 2001
9,826
1
81
ok heres what I need to do.. I have an access 97 database which is part of some phone accounting software we run.
there is a table which has about 1000 phone numbers in it in the format 1xxxxxxxxxx what i need to do is trim off the 1's before the area code from every number. Exporting the data to another app. is not an option. Is there an easy way to change all these numbers?

Thanks
DnetMHZ
 

Mitzi

Diamond Member
Aug 22, 2001
3,775
1
76
Dunno if Access supports real SQL queries but you can do it with the following SQL query...

UPDATE table_name SET column_name = LTRIM(column_name, '1');

 
Jan 18, 2001
14,465
1
0
you could also export the datafile to an csv format and trim in EXCEL using the built in functions. then reimport to Access.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Not sure if what Mitzi said will work in Access, as every ltrim() function I've seen simply left-trimmed the spaces. That's the way it is in SQL Server anyway...

You could do this, however...

update yourtable set yourphonenumberfield = mid(yourphonenumberfield, 2, len(yourphonenumberfield))
 

Mitzi

Diamond Member
Aug 22, 2001
3,775
1
76


<< Not sure if what Mitzi said will work in Access, as every ltrim() function I've seen simply left-trimmed the spaces. That's the way it is in SQL Server anyway... >>



LTRIM trims spaces if you don't provide a different set of extraction characters. Thats the SQL99 standard and how Oracle does not - not used SQL Server though.