Click here to Skip to main content
15,899,937 members
Home / Discussions / Database
   

Database

 
QuestionUnicode? Pin
Ali_1001-Feb-09 9:23
Ali_1001-Feb-09 9:23 
AnswerRe: Unicode? Pin
Colin Angus Mackay1-Feb-09 12:30
Colin Angus Mackay1-Feb-09 12:30 
Questionclustered index is 1 in table?then/// Pin
Ali_1001-Feb-09 9:14
Ali_1001-Feb-09 9:14 
AnswerRe: clustered index is 1 in table?then/// Pin
Colin Angus Mackay1-Feb-09 12:40
Colin Angus Mackay1-Feb-09 12:40 
Generaldatabase query Pin
Ali_1001-Feb-09 8:13
Ali_1001-Feb-09 8:13 
GeneralRe: database query Pin
Wendelius1-Feb-09 8:24
mentorWendelius1-Feb-09 8:24 
GeneralRe: database query Pin
Blue_Boy1-Feb-09 23:11
Blue_Boy1-Feb-09 23:11 
QuestionSQL Query help needed please Pin
munklefish1-Feb-09 0:42
munklefish1-Feb-09 0:42 
Hi,

The problem is as follows:

I need a stored proc that can provide results on the maximum channel usage for any given period (either 24 hours, or n days period).

This is calculated by finding rows that overlap (by Datestamp + Duration) as follows:

ROW DATESTAMP [START] DATESTAMP + DURATION [END] CHANNEL

A 2009-01-02 12:11:27 2009-01-02 12:11:27 + 75 = 2009-01-02 12:12:42 9
B 2009-01-02 12:11:52 2009-01-02 12:11:52 + 20 = 2009-01-02 12:12:12 10
C 2009-01-02 12:11:55 2009-01-02 12:11:55 + 23 = 2009-01-02 12:12:18 6

Because rows B & C are active while row A is still active and the channel ids are unique, then 3 channels are simultaneously active.
If the duration of row C was 50 secs (for example) then only 2 channels would be active together (ie. 9 & 10).

The test data should produce the following results from the query

(For 24 Hours starting 2009-01-02 00:00:00)
PERIOD MAX CHANNELS ACTIVE

00:00 - 01:00 0
...
09:00 - 10:00 2
10:00 - 11:00 2
11:00 - 12:00 2
12:00 - 13:00 3
...

(For @numdays starting 2009-01-02)

DATE MAX CHANNELS ACTIVE

2009-01-02 3
2009-01-03 3
2009-01-04 4
...

Any ideas would be really really appreciated.

Thanks.
AnswerRe: SQL Query help needed please Pin
Wendelius1-Feb-09 7:05
mentorWendelius1-Feb-09 7:05 
Questiondelete query in sql Pin
billcodes1-Feb-09 0:01
billcodes1-Feb-09 0:01 
AnswerRe: delete query in sql Pin
Eddy Vluggen1-Feb-09 0:38
professionalEddy Vluggen1-Feb-09 0:38 
GeneralRe: delete query in sql Pin
Rob Graham1-Feb-09 5:50
Rob Graham1-Feb-09 5:50 
GeneralRe: delete query in sql Pin
Eddy Vluggen1-Feb-09 7:07
professionalEddy Vluggen1-Feb-09 7:07 
AnswerRe: delete query in sql Pin
Rob Graham1-Feb-09 5:47
Rob Graham1-Feb-09 5:47 
GeneralRe: delete query in sql Pin
Wendelius1-Feb-09 8:27
mentorWendelius1-Feb-09 8:27 
QuestionOutputDebugString / Trace in SQL Pin
Green Fuze31-Jan-09 10:31
Green Fuze31-Jan-09 10:31 
AnswerRe: OutputDebugString / Trace in SQL Pin
Wendelius31-Jan-09 10:36
mentorWendelius31-Jan-09 10:36 
GeneralRe: OutputDebugString / Trace in SQL Pin
Green Fuze31-Jan-09 10:40
Green Fuze31-Jan-09 10:40 
GeneralRe: OutputDebugString / Trace in SQL Pin
Wendelius31-Jan-09 10:51
mentorWendelius31-Jan-09 10:51 
GeneralRe: OutputDebugString / Trace in SQL Pin
Green Fuze31-Jan-09 10:58
Green Fuze31-Jan-09 10:58 
GeneralRe: OutputDebugString / Trace in SQL [modified] Pin
Wendelius31-Jan-09 11:12
mentorWendelius31-Jan-09 11:12 
GeneralRe: OutputDebugString / Trace in SQL Pin
Green Fuze31-Jan-09 21:43
Green Fuze31-Jan-09 21:43 
GeneralRe: OutputDebugString / Trace in SQL Pin
Wendelius1-Feb-09 7:05
mentorWendelius1-Feb-09 7:05 
GeneralRe: OutputDebugString / Trace in SQL Pin
Mycroft Holmes1-Feb-09 14:23
professionalMycroft Holmes1-Feb-09 14:23 
GeneralRe: OutputDebugString / Trace in SQL Pin
Wendelius1-Feb-09 18:11
mentorWendelius1-Feb-09 18:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.