View Full Version : add new extension in the records of a colum


eon
02-12-2008, 02:07 AM
I am new here and dont know much about access but I have to do some things.

I have a table filled in access. This table (dlb_tbl) contains serveral colums. One colum named "type". The records of this colum has to be changed like this:

one record: 0RD00S101
this has to be changed into: EDH01-RD00S101

So there has to come a new extension EDH01- and the 0 has to be deleted. This has to be done to the whole colum. How can I make a query to do this?:o

MStef
02-12-2008, 03:19 AM
Look at "DemoNewExtA2000.mdb" (attachment).
Look at table, Query1UPD (update query). Run query and look at table.
It allude that the lenght of the field "type" is the same in all records
(9 letters). I think it is what you need.

m.shakeebahmed
02-12-2008, 04:43 AM
UPDATE dlb_tbl SET dlb_tbl.[type] = 'EDH01-RD00S101'
WHERE dlb_tbl.[type] ='0RD00S101'

as mentioned by MStel... make sure the length of column "type" is > 15

eon
02-18-2008, 12:15 AM
Thanks for the reply..

I have tested the solution of MStef this is working wel!

But I have now a new challege.. I have aroung 80.000 records in that same colum. Some of these has to be changed to "EDH01" and others to EDH02/03 and so on.

How should I do this.. Should I work with If Else statements? Is that good in SQL ?

MStef
02-18-2008, 11:30 PM
It can be done via query (update) with criteria.
In that case you have to run a query more times, (always with a new CRITERIA and a new UPDATE TO).
The Other way is via VBA, it require a programing.