473,513 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting value for all records

Hi

How would i go about populating a new column based on an existing column
pluse a bit of text

i.e i have a column fldID which contains numerics 1,2,3,4 etc and i want to
poulate a column fldIMAGE with values 1.jpg, 2.jpg etc.

Could anyone help me with the sql pleae.

Many thanks

Dave
Nov 15 '06 #1
3 2626

Dave wrote:
Hi

How would i go about populating a new column based on an existing column
pluse a bit of text

i.e i have a column fldID which contains numerics 1,2,3,4 etc and i want to
poulate a column fldIMAGE with values 1.jpg, 2.jpg etc.

Could anyone help me with the sql pleae.

Many thanks

Dave
Have a look at concat()

Nov 15 '06 #2
That's great, thanks, I've managed to update all of my records, but I can't
seem to set this CONCAT() as the default value. How would I do that?
"strawberry" <za*******@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>
Dave wrote:
>Hi

How would i go about populating a new column based on an existing column
pluse a bit of text

i.e i have a column fldID which contains numerics 1,2,3,4 etc and i want
to
poulate a column fldIMAGE with values 1.jpg, 2.jpg etc.

Could anyone help me with the sql pleae.

Many thanks

Dave

Have a look at concat()

Nov 15 '06 #3
Dave wrote:
That's great, thanks, I've managed to update all of my records, but I can't
seem to set this CONCAT() as the default value. How would I do that?
"strawberry" <za*******@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>>Dave wrote:

>>>Hi

How would i go about populating a new column based on an existing column
pluse a bit of text

i.e i have a column fldID which contains numerics 1,2,3,4 etc and i want
to
poulate a column fldIMAGE with values 1.jpg, 2.jpg etc.

Could anyone help me with the sql pleae.

Many thanks

Dave

Have a look at concat()



use a trigger( functionality added after 5.0 or later ) or have it done by the
application storing the data.

see: http://dev.mysql.com/doc/refman/5.0/...e-trigger.html

CREATE TRIGGER sometriggername BEFORE INSERT ON `sometable`
FOR EACH ROW
BEGIN
SET NEW.fldIMAGE = concat(NEW.fldid,'.jpg');
END
;
--
Michael Austin.
Database Consultant
Nov 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3733
by: John Hargrove | last post by:
I'm having trouble setting decimal place values in the results field of a sample management database I'm building for an environmental testing laboratory. The degree of sensitivity varies among...
3
2294
by: Chuck Reed | last post by:
I am working on a sales report where I show weekly sales by category for each of the 52 weeks in the year. Each record in my table/report has the 52 weeks of sales in it. I want to highlight to top...
5
19956
by: eliffman | last post by:
I'm trying to populate an array with the records from a recordset. But I'm getting an error. Here's the code: Dim db As Database, qd As QueryDef, rs As Recordset Dim MyArray() As Double, i As...
11
10223
by: Zlatko Matić | last post by:
Hello. I have a MS Access front-end working with PostgreSQL database. I have successfully created saved File DSN. My paa-through queries are referring to that file as well as linked tables. But I...
10
2719
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
8
1872
by: tshad | last post by:
I have a string that I read from my database: 1|8|5620|541 These are all values in my ListBox. I want to select each of these items (4 of them - but could be many more). At the moment I am...
1
3674
by: ZRexRider | last post by:
Hello, I have an MS-Access 2003 (ADP) project that uses SQL2000. I have a form that displays all "OPEN" items associated with a particular user. While viewing this form the user can click a...
1
3857
by: simon | last post by:
I have an unbound RTF2 control in an Access 2003 form which I set to show either unformatted text or else text with words and sentences highlighted. I do this by setting the PlainText property,...
1
6443
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
1
8038
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
0
7157
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7379
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5084
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.