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 |
ramu.sql
Starting Member
5 Posts |
Posted - 2009-05-12 : 06:42:04
|
i need to run one sp it shold give yesterday data into a table houe by hour total 24 hours in my table calldate is like ''20090501000312''please tell me the logic i will dothe sp |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-12 : 06:59:56
|
that is the data type for the calldate ? varchar ?"20090501000312" what's the value in red ? and where does it comes from ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
ramu.sql
Starting Member
5 Posts |
Posted - 2009-05-12 : 07:02:27
|
i have a table like cdr there call_date is like ''20090501061646''it is 06th hour 16th min 46th second,ineed to declare as Getdat()then i need hour by hour |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-12 : 07:11:58
|
using F_TABLE_NUMBER_RANGE from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47685&SearchTerms=F_TABLE_NUMBER_RANGEselect replace(replace(replace(convert(varchar(19), dateadd(hour, -NUMBER, getdate()), 121), '-', ''), ' ', ''), ':', '')from F_TABLE_NUMBER_RANGE(0,23)order by NUMBER KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|