oldmillsaddlery
asked on
I need letters added to contents of a field in a database if other letters are present.
My table name is "webstockforuploadrob" and the field name is "thumb nail image name". An example of one of the field contents is XX152TH.jpg. I need a query that adds P1 before the TH.jpg if TH.jpg is present. The result should read XX152P1TH.jpg Hope someone can help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for this but I am not getting it totally correct. I have a table called newwebstock and one of the fields is called Thumbnail Image name
UPDATE NEWWEBSTOCK SET Thumbnail_Image_name = REPLACE(Thumbnail_Image_na me,'TH.jpg ','P1TH.jp g')
WHERE RIGHT(Thumbnail_Image_name ,5)='TH.jp g';
when I run the query it asks me to enter parameter value for Thumbnail_Image_name
Sorry it is something stupid I am doing I guess
UPDATE NEWWEBSTOCK SET Thumbnail_Image_name = REPLACE(Thumbnail_Image_na
WHERE RIGHT(Thumbnail_Image_name
when I run the query it asks me to enter parameter value for Thumbnail_Image_name
Sorry it is something stupid I am doing I guess
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
in the original question, you state
the field name is "thumb nail image name".
in the query you posted, you have the name as
Thumbnail_Image_name
which is it, as it cannot be both. The fact that you are getting a prompt for that 'parameter' name (Thumbnail_Image_name) suggests that the field is actually named
thumb nail image name
the field name is "thumb nail image name".
in the query you posted, you have the name as
Thumbnail_Image_name
which is it, as it cannot be both. The fact that you are getting a prompt for that 'parameter' name (Thumbnail_Image_name) suggests that the field is actually named
thumb nail image name
Can you post a describe for newwebstock so we can see actual field name? Also, you can eliminate additional executions by adding -
and RIGHT(Thumbnail_Image_name ,7) <>'P1TH.jpg';
and RIGHT(Thumbnail_Image_name
ASKER
Thanks all I seem to have got things sorted with the file name
Glad to be of assistance. Just need to be sure that once this query has been executed, that it is not executed again, as I noted, above.
AW
AW
By the way, it should be
where right(<fieldname>,6) = 'TH.jpg'
and right(<fieldname>,8) <> 'P1TH.jpg'
where right(<fieldname>,6) = 'TH.jpg'
and right(<fieldname>,8) <> 'P1TH.jpg'
WHERE RIGHT(image_name,5)='TH.jp