Hi everyone!
I have inherited a SQL database that works OK for the most part. However I have also inherited a VB program that will query the database for a range of dates and then display those dates in a report.
The problem happens when you try and query a range for example of 04-25-2005 thru 04-26-2005. The query returns all the instances of 04-25-2005 and 04-26-2005 but also returns instances of 04-25-2004 and 04-26-2004.
The table queried is setup with the date field type as
varchar(15). The query string is:
select date from table where date >= '04-25-2005' and date <= '04-26-2005';
I have tried changing the syntax of the select statement and tried changing the field type to varchar(20) but no luck.
Any ideas or comments would be appreciated!!!
RB
I have inherited a SQL database that works OK for the most part. However I have also inherited a VB program that will query the database for a range of dates and then display those dates in a report.
The problem happens when you try and query a range for example of 04-25-2005 thru 04-26-2005. The query returns all the instances of 04-25-2005 and 04-26-2005 but also returns instances of 04-25-2004 and 04-26-2004.
The table queried is setup with the date field type as
varchar(15). The query string is:
select date from table where date >= '04-25-2005' and date <= '04-26-2005';
I have tried changing the syntax of the select statement and tried changing the field type to varchar(20) but no luck.
Any ideas or comments would be appreciated!!!
RB