Solved

updating a field with an additional item

Posted on 2002-07-08
5
139 Views
Last Modified: 2013-12-24
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?

 
0
Comment
Question by:sagardeo
5 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 7139025
besides querying, appending using CF and updating?

CJ
0
 

Author Comment

by:sagardeo
ID: 7139093
no that way is fine.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7139392
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
0
 
LVL 17

Expert Comment

by:anandkp
ID: 7140525
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
0
 
LVL 2

Accepted Solution

by:
tleish earned 200 total points
ID: 7147630
You can do it in one query.  Append the numbers using the current name of the Table field row with the "&" concatination.

=== START CODE EXAMPLE ===

<cfset num = "987654321">
<cfquery name="qUpdate">
     update tableName
     set memoField = memoField & ' #variables.num#'
     where id = #myVar#
</cfquery>

=== END CODE EXAMPLE ===

If you have multiple items to update, just include it in that query.

=== START CODE EXAMPLE ===

<cfset num = "987654321">
<cfquery name="qUpdate">
     update tableName
     set name = '#newName#',
          address = '#newAddress#',
          memoField = memoField & ' #variables.num#'
     where id = #myVar#
</cfquery>

=== END CODE EXAMPLE ===
0

Featured Post

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Join & Write a Comment

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now