Link to home
Start Free TrialLog in
Avatar of Judy Deo
Judy DeoFlag for United States of America

asked on

updating a field with an additional item

okay i have a micrsoft access database that contains a memo field which has a bunch of 9 digit numbers separated by spaces.

i.e

123456789 987456321 123789456 ....

i want to be able to update this field by adding a new 9 digit number to the end of it (i.e a space followed by the 9 digit number)

how do i do this?

 
Avatar of cheekycj
cheekycj
Flag of United States of America image

besides querying, appending using CF and updating?

CJ
Avatar of Judy Deo

ASKER

no that way is fine.
so you build a query:

<cfquery name="getCurrentData">
select columname
from tablename
where primary_key_column = foo
</cfquery>

<cfset getCurrentData.columname = getCurrentData.columname & " " & yourNewNumberVariable>

<cfquery name="updateData">
update tablename
set columname = '#getCurrentData.columname#'
where primary_key_column = foo
</cfquery>

if you give me the Db specifics and varnames I can give you the precise code.

HTH,
CJ
Hi,

Use a delimeter in ur Query as '~' so u can clearly distinguish the elements of the list.

the reason why i am saying this is having a delimeter is helpful [as in it increases the readability & also reduces the chances of errors]

when u want to append - use
cfset x = "ur originallist"
newlist = listappend(x,'new number','~')

but when u insert [newlist] in ur table - just use a replace fucntion on newlist & replace ur '~' with a " " & that should solve ur issue.

K'Rgds
Anand
ASKER CERTIFIED SOLUTION
Avatar of tleish
tleish

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial