Adding prefix to records

5 pts.
Tags:
Database programming
Microsoft Access
UPDATE statement
Hi, I have a simple database for some products that has some SKU numbers... ie SKU 1001-01076-0000 1001-01120 1001-01120-2100 1001-01120-2400 1001-01121 1001-01121-2100 What I want to do is add the prefix "GF-" in front of those SKUs. This is a database that will continually get sent to me, so adding the "GF-" manually in the database table is not an option. Is there a query command that I can run to add the prefix "GF-" without making a big fuss? What is the easiest way for me to do this? Please e-mail answers to hanh@terrapass.com

Answer Wiki

Thanks. We'll let you know when a new response is added.

Yes, you can add prefix with UPDATE statement, however syntax may slightly differ in different RDBMS
This is how you can do in Oracle:

<pre> UPDATE table1 SET colomnnameSKU =’GF-’ || SKU
WHERE upper(colomnnameSKU) like ‘SKU%’;</pre>

The Access syntax will look slightly different.

<pre>UPDATE YourTable
Set Sku ‘GF-’ + Sku
WHERE Sku NOT LIKE ‘GF-%’</pre>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Rockleadme
    Hi, Surprisingly i am having trouble suffixing any character to a flat file (AS400) help please !!! thanks
    385 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following