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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql to DB2 Convert to Date

Status
Not open for further replies.

rwaldron

MIS
Aug 6, 2002
53
IE
Hi all,
I have a linked sevrer from SQL to DB2.
I have a column in DB2 ( Called Dispatched ) that is in the form 200060125 ie: Todays Date.
However within DB2 the Datatype of this field is NOT a date.
It is an 8 Digit Numeric.

How to I convert this to a proper data data type ( Directly in DB2) or in SQL
so that I can run some queries comparing it to the Current date (Getdate) in sql.

I have also used "current date" in DB2 that does return a proper date to SQL but
the column I need to compare any date with is Dispatched

Any help Much appretiated

P.s Just another quick question....I use SQL Query Analyzer alot.
But how do I know what Datatypes are returned from a query in the analyser from a results view ??
This would help alot see how sql has treated certain datatypes by default.

Ray..
 

You could try using the CAST(<col> AS DATE ...) function.

[3eyes]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top