Update in SQL

295 pts.
Tags:
Flat files
SQL/400
SQL0104
UPDATE statement
I have a flat file which I want to update starting from position 2 to 4. I used below UPDATE statement: UPDATE FLAT_FILE SET SUBSTR(FLAT_FILE,2,2)= 'AA' WHERE SUBSTR(FLAT_FILE,1,2) = 'HH' The above SQL Query is throwing an error SQL0104 for missing token. Can anybody suggest me on the above. Thank You.
ASKED: September 30, 2008  12:01 PM
UPDATED: October 1, 2008  3:17 PM

Answer Wiki

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

You can’t have a function on the left side of an update, it must be the entire column. Try this:

UPDATE FLAT_FILE
SET FLAT_FILE = SUBSTR(FLAT_FILE,1,1)|| ‘AA’||SUBSTR(FLAT_FILE,4)
WHERE SUBSTR(FLAT_FILE,1,2) = ‘HH’

Discuss This Question:  

 
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

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