| 
 Posted by fjleon on 07/01/57 11:48 
Hi, i have a table with 3 ints that are used to store dates. The 
datetime data type is not used because this data comes from an old 
AS400 server. 
 
I need to be able to use those 3 columns to build dates within a query 
and be able to use them to compare themselves to other dates 
 
Let's say the table has the following values: 
 
myday  mymonth  myyear 
23              5         2006 
 
and suppose i want to do a query that displays all rows with date 
greater than '20060520' 
 
Here is the query i have tried: 
 
select 
cast(myday as varchar(2))+'/'+cast(mymonth as 
varchar(2))+'/'+cast(myyear as varchar(4)) 
from mytable 
 
That query returns the string '23/5/2006' yet i can't use it to compare 
it with '20060520' 
 
Is there a way i can do this in a simple query? 
This is on sql server 2000
 
[Back to original message] 
 |