Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Right Function in AS400 SQL

Status
Not open for further replies.

RiverGuy

Programmer
Jul 18, 2002
5,011
US
I'm a Micrsoft programmer, but I am always retrieving data from AS400. But I have a field where my dates are stored as a decimal, i.e., 1102 for Jan. 1, 2002, or 101599 for Oct. 15, 99. So basically, I need the right two characters because I need to get the year at the least. It would be nice if I could convert it to a whole date as well.

But just the year would be OK. I don't see a way I could use substr() in an SQL statement that would consistently select the year, because the total number of characters would vary.

If all else fails, I will get my recordset in VB and make a function to evaluate the length of the date and strip out the year appropiately.

But I was wondering if anyone knows of a "Right"-like function that might do what I need.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top