hi, try this
Main Topics
Browse All Topicslst_chnge_dte is a field on db2 table that is defined as decimal & contains date in format yyyymmdd, for instance 20060405
want to update lst_chnge_dte with current date
was going to use
(select CONVERT(VARCHAR(8), GETDATE(), 112)
& will need to convert to decimal
any suggestions on what the update statement would look like??
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
For DB2's query
UPDATE MyTable
SET lst_chnge_dte = DECIMAL(REPLACE(CHAR(NOW()
For more info, see IBM DB2 SQL Reference manual at http://publib.boulder.ibm.
MORE LIKE ...
UPDATE MyTable
SET lst_chnge_dte = DECIMAL(REPLACE(CHAR(cURRE
USE THE CURRENT DATE SPECIAL REGISTER....
WHICH VERSION / OPERATING SYSTEM OF db2 ARE YOU USING
BTW
WHY USE DECIMAL FOR THE DATE ?
you'll have a much easier life working with a proper date/time column data type
Since the CONVERT function (as it's been used above) is a Microsoft SQL-Server-specific function, it certainly won't work on DB2.
I like lowfatspread's method. I'd probably use CAST instead of NUMERIC, but either way, it works on DB2.
e.g.
select cast(replace(char(current date),'-','') as numeric(8,0)) aDate
from sysibm.sysdummy1
ADATE
20,080,219
HTH,
DaveSlash
Business Accounts
Answer for Membership
by: asvforcePosted on 2008-02-18 at 21:35:35ID: 20926003
something like this.
Update db2table set lst_chnge_dte = Cast(CONVERT(VARCHAR(8), GETDATE(), 112) as decimal)