| Author |
Topic |
|
Sam86
Starting Member
5 Posts |
Posted - 2008-07-31 : 07:52:15
|
| Hi All,My table contains DateTime Field which Contains values 1.2008-07-10 17:10:43.6702.2008-07-31 17:10:42.6703.2008-07-12 17:31:42.6704.2008-07-15 17:52:42.6705.2008-08-03 17:45:42.6706.2008-07-16 17:23:42.6707.2008-08-04 17:35:42.6708.2008-07-31 17:35:42.6709.2008-07-01 17:25:42.67010.2008-08-02 17:20:42.670i need 2,5,7,8,10 columns as answers .How i need answers is ,the dates will befuture dates from today and including today date . |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-31 : 08:00:53
|
[code]select *from mytablewhere DateTime >= dateadd(day, datediff(day, 0, getdate()), 0)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Sam86
Starting Member
5 Posts |
Posted - 2008-07-31 : 08:21:41
|
| Thank you its working correct.But if had date 7/31/2008 ,i need answer as Thursday, July 31 ,2008 as answer |
 |
|
|
VGuyz
Posting Yak Master
121 Posts |
Posted - 2008-07-31 : 08:34:13
|
| Hi chk thisselect * from table where datetimefield >getdate() |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-31 : 08:34:56
|
quote: Originally posted by Sam86 Thank you its working correct.But if had date 7/31/2008 ,i need answer as Thursday, July 31 ,2008 as answer
That is just presentation of the date. Format it to the required format in your front end application KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
VGuyz
Posting Yak Master
121 Posts |
Posted - 2008-07-31 : 08:38:54
|
| Hi chk this,SELECT DATENAME(DW, GETDATE())+', '+ DATENAME(MM, GETDATE()) + RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) AS [Weekday ,Month DD, YYYY] |
 |
|
|
Sam86
Starting Member
5 Posts |
Posted - 2008-07-31 : 08:41:13
|
| For VGuyzThat too getting answer but not getting todaydate |
 |
|
|
Sam86
Starting Member
5 Posts |
Posted - 2008-07-31 : 08:45:25
|
| i dont need for todaydate and i need for future dates and todaydate which was in database table |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-31 : 09:02:01
|
Sam, what is the issue ? The query i posted earlier gives you the required result ?quote: i need answer as Thursday, July 31 ,2008 as answer
Not sure what do you mean here but basically this is just a presentation issue. Do the required formatting at your front end application. If you had to do it in T-SQL then check out the Books Online on CONVERT(). KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
VGuyz
Posting Yak Master
121 Posts |
Posted - 2008-07-31 : 09:14:29
|
quote: Posted - 07/31/2008 : 08:41:13 For VGuyzThat too getting answer but not getting todaydate
Instead of getdate() put u'r column name in the query. |
 |
|
|
Sam86
Starting Member
5 Posts |
Posted - 2008-07-31 : 09:16:24
|
| k.Thank you i got the answer |
 |
|
|
|