Storing Date in Integer Field
Moderators: chulett, rschirm, roy
Storing Date in Integer Field
I have an integer column in a database that is initially NULL. I need to read this column in and send the current date back to this integer field in the database with the YYYYMMDD format. I would never design anything this way, but it is what I've been given to work with. I have tried using: Int(Oconv(Date(), "D-YMD[4,2,2]")) as well as Int(Oconv(@DATE, "D YMD[4,2,2]")) and other variations. Although it compiles and runs, the db field is not being populated. Any help would be appreciated.
Try stripping the date separators from the field. For example:
Code: Select all
EReplace(Oconv(Date(),"D-YMD[4,2,2]")),"-","")-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Or
Code: Select all
Oconv(Date(), "D-YMD[4,2,2]" : @VM : "MCN")IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ok, you lost me a little on that one Ray.
Maybe more than a little.
Not someplace where I can just plug in the syntax, so brain only at this point. It's similar to using the DIGITS transform, but I don't get the use of the value mark. Have to VPN in and check it out...
Not someplace where I can just plug in the syntax, so brain only at this point. It's similar to using the DIGITS transform, but I don't get the use of the value mark. Have to VPN in and check it out...
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Multiple Conversion Technique
Iconv() and Oconv() functions can perform multiple conversions; the list of conversion specifications is presented as a multi-valued field (that is, conversion specifications separated from each other by value marks). It's a handy shortcut sometimes.
The DIGITS Transform is, under the covers, Oconv(%Arg%, "MCN"); it preserves only the numeric digits of its argument.
The DIGITS Transform is, under the covers, Oconv(%Arg%, "MCN"); it preserves only the numeric digits of its argument.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Re: Multiple Conversion Technique
ray.wurlod wrote:Iconv() and Oconv() functions can perform multiple conversions; the list of conversion specifications is presented as a multi-valued field (that is, conversion specifications separated from each other by value marks). It's a handy shortcut sometimes.
Zowie. I had no clue you could do that.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
