SELECT Statement returns no records.... 
Author Message
 SELECT Statement returns no records....

Okay very simple.....I have the following SELECT statement in an asp page,
but it returns no records.  The records ARE in the database, and they are of
the format dd/mm/yy (just like the sql)  Is there something I'm overlooking?

SQL:
"  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE = #11/07/00#  "

TIA!
Joseph



Sat, 28 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....

I forgot to specify....I'm using Access 2000.
They are stored as dd/mm/yy.


Quote:
> Dates in SQL server are normally stored in datetime format
> try  .... and  convert(varchar(10),date,101) = "11/07/2000"
> that chops off the time part....

> Russ



> > Okay very simple.....I have the following SELECT statement in an asp
page,
> > but it returns no records.  The records ARE in the database, and they
are
> of
> > the format dd/mm/yy (just like the sql)  Is there something I'm
> overlooking?

> > SQL:
> > "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
#11/07/00#
> "

> > TIA!
> > Joseph



Sat, 28 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....
Yes, I tried.....no luck.  Sorry.


Quote:
> Joseph,
> Did you do what I suggested and reverse the date data in your variable?
> To: SQL: = "SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =>
> #7/11/00#

> And if so did this return the recordset that you were hoping to see in the
> first place?

> I'm just curious because I spent about 3 hours last night on exactly this
> problem.

> Thanks,
> lagerBoy



> > I forgot to specify....I'm using Access 2000.
> > They are stored as dd/mm/yy.



> > > Dates in SQL server are normally stored in datetime format
> > > try  .... and  convert(varchar(10),date,101) = "11/07/2000"
> > > that chops off the time part....

> > > Russ



> > > > Okay very simple.....I have the following SELECT statement in an asp
> > page,
> > > > but it returns no records.  The records ARE in the database, and
they
> > are
> > > of
> > > > the format dd/mm/yy (just like the sql)  Is there something I'm
> > > overlooking?

> > > > SQL:
> > > > "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
> > #11/07/00#
> > > "

> > > > TIA!
> > > > Joseph



Sat, 28 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....
Does it return any records if you change the sqlString to:
sql= "SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
#07/11/00#"

Just wondering because I had some date difficulty (and not because I ate too
much curry!) last night.


Quote:
> Okay very simple.....I have the following SELECT statement in an asp page,
> but it returns no records.  The records ARE in the database, and they are
of
> the format dd/mm/yy (just like the sql)  Is there something I'm
overlooking?

> SQL:
> "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE = #11/07/00#
"

> TIA!
> Joseph



Sun, 29 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....
Dates in SQL server are normally stored in datetime format
try  .... and  convert(varchar(10),date,101) = "11/07/2000"
that chops off the time part....

Russ


Quote:
> Okay very simple.....I have the following SELECT statement in an asp page,
> but it returns no records.  The records ARE in the database, and they are
of
> the format dd/mm/yy (just like the sql)  Is there something I'm
overlooking?

> SQL:
> "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE = #11/07/00#
"

> TIA!
> Joseph



Sun, 29 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....
Joseph,
Did you do what I suggested and reverse the date data in your variable?
To: SQL: = "SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =>
#7/11/00#

And if so did this return the recordset that you were hoping to see in the
first place?

I'm just curious because I spent about 3 hours last night on exactly this
problem.

Thanks,
lagerBoy


Quote:
> I forgot to specify....I'm using Access 2000.
> They are stored as dd/mm/yy.



> > Dates in SQL server are normally stored in datetime format
> > try  .... and  convert(varchar(10),date,101) = "11/07/2000"
> > that chops off the time part....

> > Russ



> > > Okay very simple.....I have the following SELECT statement in an asp
> page,
> > > but it returns no records.  The records ARE in the database, and they
> are
> > of
> > > the format dd/mm/yy (just like the sql)  Is there something I'm
> > overlooking?

> > > SQL:
> > > "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
> #11/07/00#
> > "

> > > TIA!
> > > Joseph



Sun, 29 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....
perhaps the date format depends on the server
have you tried mm/dd/yyyy in your query just to see
if i'm wrong


Quote:
> Okay very simple.....I have the following SELECT statement in an asp page,
> but it returns no records.  The records ARE in the database, and they are
of
> the format dd/mm/yy (just like the sql)  Is there something I'm
overlooking?

> SQL:
> "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE = #11/07/00#
"

> TIA!
> Joseph



Sun, 29 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....

try to put quotes over the date, like '#01/01/00#'



Quote:
> Yes, I tried.....no luck.  Sorry.



> > Joseph,
> > Did you do what I suggested and reverse the date data in your variable?
> > To: SQL: = "SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =>
> > #7/11/00#

> > And if so did this return the recordset that you were hoping to see in
the
> > first place?

> > I'm just curious because I spent about 3 hours last night on exactly
this
> > problem.

> > Thanks,
> > lagerBoy



> > > I forgot to specify....I'm using Access 2000.
> > > They are stored as dd/mm/yy.



> > > > Dates in SQL server are normally stored in datetime format
> > > > try  .... and  convert(varchar(10),date,101) = "11/07/2000"
> > > > that chops off the time part....

> > > > Russ



> > > > > Okay very simple.....I have the following SELECT statement in an
asp
> > > page,
> > > > > but it returns no records.  The records ARE in the database, and
> they
> > > are
> > > > of
> > > > > the format dd/mm/yy (just like the sql)  Is there something I'm
> > > > overlooking?

> > > > > SQL:
> > > > > "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
> > > #11/07/00#
> > > > "

> > > > > TIA!
> > > > > Joseph



Sun, 29 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....
look at the dates in the database. If they have a time other than 00:00:00
you will not match them with the = operator. Try between.

--
Mark Schupp
--
Head of Development
Integrity eLearning
Online Learning Solutions Provider
Authorized Macromedia Training Center

http://www.ielearning.com
714.637.9480 x17


Quote:
> I forgot to specify....I'm using Access 2000.
> They are stored as dd/mm/yy.



> > Dates in SQL server are normally stored in datetime format
> > try  .... and  convert(varchar(10),date,101) = "11/07/2000"
> > that chops off the time part....

> > Russ



> > > Okay very simple.....I have the following SELECT statement in an asp
> page,
> > > but it returns no records.  The records ARE in the database, and they
> are
> > of
> > > the format dd/mm/yy (just like the sql)  Is there something I'm
> > overlooking?

> > > SQL:
> > > "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
> #11/07/00#
> > "

> > > TIA!
> > > Joseph



Sun, 29 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....

The dates are stored without any time values.....just dd/mm/yy.  The values
are being entered via a form, with a dropdown box to select the day, month,
and year.  There is no time associated whatsoever

--


Quote:
> look at the dates in the database. If they have a time other than 00:00:00
> you will not match them with the = operator. Try between.

> --
> Mark Schupp
> --
> Head of Development
> Integrity eLearning
> Online Learning Solutions Provider
> Authorized Macromedia Training Center

> http://www.ielearning.com
> 714.637.9480 x17



> > I forgot to specify....I'm using Access 2000.
> > They are stored as dd/mm/yy.



> > > Dates in SQL server are normally stored in datetime format
> > > try  .... and  convert(varchar(10),date,101) = "11/07/2000"
> > > that chops off the time part....

> > > Russ



> > > > Okay very simple.....I have the following SELECT statement in an asp
> > page,
> > > > but it returns no records.  The records ARE in the database, and
they
> > are
> > > of
> > > > the format dd/mm/yy (just like the sql)  Is there something I'm
> > > overlooking?

> > > > SQL:
> > > > "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
> > #11/07/00#
> > > "

> > > > TIA!
> > > > Joseph



Sun, 29 Dec 2002 03:00:00 GMT  
 SELECT Statement returns no records....
Every body writes the satements a little different. here is how I would
write it:
SELECT * FROM POWER_USAGE WHERE (ID="gm") AND (DATE=#11/7/2000#);



Quote:
> try this

> SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE = #11-07-00#  "



> > Okay very simple.....I have the following SELECT statement in an asp
page,
> > but it returns no records.  The records ARE in the database, and they
are
> of
> > the format dd/mm/yy (just like the sql)  Is there something I'm
> overlooking?

> > SQL:
> > "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
#11/07/00#
> "

> > TIA!
> > Joseph



Thu, 23 Jan 2003 03:00:00 GMT  
 SELECT Statement returns no records....
Everybody writes them a little different, but here is how I would write it:

SELECT * FROM POWER_USAGE WHERE (ID='gm') AND (DATE=#11/7/2000#)



Quote:
> try this

> SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE = #11-07-00#  "



> > Okay very simple.....I have the following SELECT statement in an asp
page,
> > but it returns no records.  The records ARE in the database, and they
are
> of
> > the format dd/mm/yy (just like the sql)  Is there something I'm
> overlooking?

> > SQL:
> > "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE =
#11/07/00#
> "

> > TIA!
> > Joseph



Thu, 23 Jan 2003 03:00:00 GMT  
 SELECT Statement returns no records....
When troubleshooting always eleminate all possible errors.  Your code should
work so try:
Select * from POWER_USAGE where CLIENT_ID = 'GM'
If you get records then your real problem is probably the use of the work
DATE in your statement.  Change that field to something else like DTM -- for
Date TiMe and the try the query
SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE = #11/07/00#

Using reserved words is the hardest thing to not do.  I would suspect that
is where the real problem lies.

Jon Boss


Quote:
> Okay very simple.....I have the following SELECT statement in an asp page,
> but it returns no records.  The records ARE in the database, and they are
of
> the format dd/mm/yy (just like the sql)  Is there something I'm
overlooking?

> SQL:
> "  SELECT * FROM POWER_USAGE WHERE CLIENT_ID = 'GM' AND DATE = #11/07/00#
"

> TIA!
> Joseph



Fri, 24 Jan 2003 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Counting records returned by SQL Select statement

2. How to select the current record only with SELECT statement

3. Combo click event returns 1st record not selected record

4. select statement .... value return an alias

5. ADO/Sybase...Need SELECT statement that will only return 1 row

6. executing SELECT statement with return value from other stored procedure

7. OleDB Select Top statement not returning data??

8. running sql code record by record instead of statement by statement

9. SQL Statement does not return records

10. SQL Statement returns records in Access but not in ADO

11. Phantom records in select statement w/RDO

12. Need help with Select statement syntax to retrieve Access2000 record between two dates

 

 
Powered by phpBB® Forum Software