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!

Search on Date

Status
Not open for further replies.

debbie1212

Programmer
May 31, 2000
66
US
I'm trying to do a search by a date but since the field also contains a time, it's not finding the date. I was told I need to use a time range but I don't know the format.

Also, do I put it in the ASP code or in the stored procedure?

Any help would be appreciated.

Thanks,
Debbie
 
A stored procedure is much faster, but the sql statement for searching for date and time would be..

strSQL = "SELECT from table_name where date_table like '%00/00/00%'"

You may even want to try with a hash value instead of single quotes.

hash value = like #%00/00/00%#"

I am however not sure if hash work for time is well, but most likely the first one will work for you.

- Jason
www.vzio.com
ASP WEB DEVELOPMENT



 
This is what I tried in the stored procedure and it didn't work.

WHERE REQ_DATE = @datReq_Date like '%00/00/00%'

It says incorrect syntax near like.

Unfortunately the way we are passing the values to the stored procedure are different so I can't get it right. This is what we have:

strFields=""
strFields = strFields & Utility_sPrepareDate(datReq_Date)
strFields = strFields & ", " & Utility_sPrepareNumber(intStartRow, 1000000)
strFields = strFields & ", " & Utility_sPrepareNumber(parm_EndRow, 1000000)

strSQL="FolderRequest_GetByReqDate"

Any ideas?
 
I am actully not familar with stored procedures, I don't use them, because I am using MySQL as a database, and they arn't built in it yet. Wish I could help you more.

- Jason www.vzio.com
ASP WEB DEVELOPMENT



 
as I can recall you should use between.. can't remember how to implement it though =) but memory will comeback... or so I hope..

perhaps you can figure it out by your self? My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
I'm trying. I've tried several things and they aren't working.

Thanks,
Debbie
 
Try this code we used in an example for Progress.. should work well for you too, havn't tried it though...
not complete as you can see =)

SELECT * FROM Car WHERE registered > 01/01/00 AND registered < 12/31/00 My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top