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 |
|
msugradus
Starting Member
40 Posts |
Posted - 2007-06-12 : 13:45:25
|
| I have a user enter a start end end date to create a report and I would like to append a static time 23:59:59 to the date that the user enters. I have tried several methods and I am having no luck..... |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-06-12 : 13:46:48
|
| Instead of using BETWEEN and trying to add 23:59:59 to the second date, you are better off doing this:where SomeDate >= @startDate and SomeData < @endDate- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
subrata4allfriends
Starting Member
24 Posts |
Posted - 2007-06-12 : 14:51:21
|
| Hi, Please try those examples, EXAMPLE 1:SELECT CONVERT(VARCHAR(10), GETDATE(),120) + ' 23:59:59'EXAMPLE 2:SELECT CONVERT(VARCHAR(10), '2007-06-01 00:42:40.000',120) + ' 23:59:59'EXAMPLE 3:SELECT CONVERT(VARCHAR(10), YOUR_COLUMN_NAME,120) + ' 23:59:59'FROM YOUR_TABLE_NAME"Life is not a bed of roses." |
 |
|
|
yumyum113
Starting Member
31 Posts |
Posted - 2007-06-12 : 20:29:51
|
| May be this would help.declare @startdate datetimedeclare @enddate datetimeset @startdate = '01/01/2007 12:00'set @enddate = getdate()select dateadd(s,-1,datediff(d,0,@startdate)+1) as 'Start date',dateadd(s,-1,datediff(d,0,@enddate)+1) as 'End date'/*Variables @startdate and @enddate are the date entered by the user*/ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-12 : 23:25:55
|
see199,Your question is not directly related to this thread. Please start a new thread for your question. KH |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|