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 |
|
Thiyagu_04
Starting Member
37 Posts |
Posted - 2008-11-18 : 04:56:04
|
| Hi one of my procedure checking date condition like this "where convert(varchar,dt,101)=@t" inside procedure many places i need to check this type of date condition.i am getting performance issue any feasible way to check the date condtion. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-18 : 04:59:23
|
| Try usingwhere dt>=dateadd(day,datediff(day,0,@t),0)and dt<dateadd(day,datediff(day,0,@t),1)MadhivananFailing to plan is Planning to fail |
 |
|
|
bjoerns
Posting Yak Master
154 Posts |
Posted - 2008-11-18 : 05:01:15
|
| declare @dt datetime = convert(datetime, @t, ...)...where dt = @dt |
 |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2008-11-18 : 05:01:47
|
| madhi How can you say, statement you mentioned is faster then the described earlier. |
 |
|
|
bjoerns
Posting Yak Master
154 Posts |
Posted - 2008-11-18 : 05:03:38
|
| Ah sorry, didn't get the 101 format. Anyway, store the results of madhivanan's calculations in variables first. |
 |
|
|
|
|
|
|
|