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 |
rajnidas
Yak Posting Veteran
97 Posts |
Posted - 2013-12-19 : 05:45:47
|
hi every one,i need procedure query for two date between fromdate and todatepls. i need helpalter procdure datedeclare @Fromdate varchar(10)declare @todate varchar(10)as begin select * from master where convert(varchar(10),@Fromdate,121) between CONVERT(varchar(10),@Todate,121) and CONVERT(varchar(10),rr.Original_Date,121)endThanksRajnidas |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-12-19 : 06:29:43
|
What is the Datatype of Original_date column? Why are you set @FromDAte & @ToDate types as VARCHAR(10)? Better to have DATETIME data type--Sampledeclare @Fromdate DATE = '2013-12-19'declare @todate DATE = '2013-12-20'select * from test1223where c1 BETWEEN @Fromdate AND @Todate--Chandu |
|
|
rajnidas
Yak Posting Veteran
97 Posts |
Posted - 2013-12-19 : 07:24:28
|
thanks for your response |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2013-12-24 : 07:21:02
|
If the time part is included in the dates, useselect * from test1223where c1 >=@Fromdate AND c1< dateadd(day,1,@Todate)MadhivananFailing to plan is Planning to fail |
|
|
|
|
|