Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
danwiley2001
Starting Member
2 Posts |
Posted - 2007-03-05 : 08:53:48
|
| I have developed a CF application and now need to add some charts to it for admin purposes. I have a form page that uses a calendar widget to let a manager select a date range and submits to display data for that timeframe. I need to convert the formfields to a date for my WHERE clause in my query. My experience to this point has just been simple queries of one table. below is a sample I found and modified numerous time to try and make it work with no success. Can anyone give me a hand with this?SELECT COUNT ((CHG_TYP_CD)) AS CHG_TYP, CHG_TYP_CD FROM WRK_RQS WHERE(CAST('form.startdate' AS datetime) >= RQS_SBM_TS) AND (CAST('form.startdate' AS datetime) <= RQS_SBM_TS) GROUP BY CHG_TYP_CD |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-05 : 08:59:01
|
Is this statement part of Stored Procedure?Create a datetime variable, set it's value to form.StartDate and use this variable in the query:SELECT COUNT ((CHG_TYP_CD)) AS CHG_TYP,CHG_TYP_CDFROM WRK_RQSWHERE @myDate between RQS_SBM_TS AND RQS_SBM_TSGROUP BY CHG_TYP_CD Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-05 : 09:01:20
|
quote: WHERE @myDate between RQS_SBM_TS AND RQS_SBM_TS
Am i seeing things or this is same as WHERE @myDate = RQS_SBM_TS ? KH |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-05 : 09:04:40
|
You are right!Simplicity to the point of absurdity. Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
danwiley2001
Starting Member
2 Posts |
Posted - 2007-03-05 : 09:52:37
|
| but does that solve the problem of @myDate still being a varchar and then trying to convert that to date datatype? |
 |
|
|
|
|
|