Page 1 of 1

Storing Date in Integer Field

Posted: Fri Aug 19, 2005 11:53 am
by ckaiser1
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.

Posted: Fri Aug 19, 2005 11:55 am
by chulett
Try stripping the date separators from the field. For example:

Code: Select all

EReplace(Oconv(Date(),"D-YMD[4,2,2]")),"-","")

Posted: Fri Aug 19, 2005 5:09 pm
by ray.wurlod
Or

Code: Select all

Oconv(Date(), "D-YMD[4,2,2]" : @VM : "MCN")

Posted: Fri Aug 19, 2005 7:03 pm
by chulett
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...

Multiple Conversion Technique

Posted: Sat Aug 20, 2005 1:18 am
by ray.wurlod
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.

Re: Multiple Conversion Technique

Posted: Sat Aug 20, 2005 7:09 am
by chulett
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. 8)