Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Same Value to Every Row

Status
Not open for further replies.

metaphiz

Programmer
Jun 30, 2004
91
US
I have a table 'Items' with product info. One of the fields is an image field which gives the name of an image. It is only the image name, however, and I need it to be a full web URL. Where the image field is called 'Image1', what is the Access-friendly SQL to insert the string ' in front of the image name for every row in the table? The string must be inserted before the image name and the image name must not be replaced, so each cell in the row would look like this:
 
I'm new to SQL...Can you give me sample syntax?
 
You will need to check it closer but I think your exact syntax would be

UPDATE items SET Image1 = "' & items.Image1

then you might for future updates set it to something like

UPDATE items SET Image1 = "' & items.Image1
WHERE LEN(Image1) <24

this would stop it from appending it twice
 
UPDATE items SET Image1 = ' & Image1
WHERE Image1 Not Like 'http*'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, everyone. This worked like a charm. Didn't recognize it was SQL because I've never seen the & sign and didn't know how it worked. If anyone can point me to an good online reference (especially examples), I'd appreciate it. I think I've sort of exhausted my existing 'quickie' reference book for SQL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top