Click here to Skip to main content
15,921,884 members
Home / Discussions / Database
   

Database

 
GeneralRe: How to get the last inserted and updated id (primary_key) with Sql C# Pin
David Salter30-Apr-03 11:37
David Salter30-Apr-03 11:37 
AnswerRe: How to get the last inserted and updated id (primary_key) with Sql C# Pin
Chris Maunder26-Apr-03 12:42
cofounderChris Maunder26-Apr-03 12:42 
GeneralFilter and Delete Question Pin
Toni7825-Apr-03 6:54
Toni7825-Apr-03 6:54 
GeneralDefault number of Decimals. Pin
Chris Meech25-Apr-03 5:58
Chris Meech25-Apr-03 5:58 
GeneralRe: Default number of Decimals. Pin
Toni7825-Apr-03 7:07
Toni7825-Apr-03 7:07 
QuestionA mostly working SP ? Pin
Mike Osbahr25-Apr-03 4:14
Mike Osbahr25-Apr-03 4:14 
AnswerRe: A mostly working SP ? Pin
perlmunger30-Apr-03 5:14
perlmunger30-Apr-03 5:14 
Generalinteresting TSQL Q Pin
User 814724-Apr-03 7:49
User 814724-Apr-03 7:49 
Hi..

I have a table which includes 2 datetime fields. One is Start_DTM, the other is Finish_DTM. It's for employee hours. My typical day would be

Start_DTM Finish_DTM
(date)09.00 (date)13.00
(date)13.00 (date)14.00
(date)14.00 (date)17.00

So, you see it records *everything* including breaks. If I do a SELECT query
where start_DTM or Finish_DTM = (date) then I get the above info.

Of course things get complicated.
Lets say I work a night shift.... like

Start_DTM Finish_DTM
(date)20.00 (date)23.00
(date)23.00 (date+1)01.00
(date+1)01.00 (date+1)04.00
(date+1)04.30 (date+1)05.00

Now... as far as my boss is concerned, I worked from 9pm til 4am on (date).
(Disregard the 4.30 to 5am as it didn't follow on from 4 am)
So when I look for work done on (date) I should also bring back anything
recorded into the next day under certain conditions:
Where there is a record which *starts* on (date) and *finishes* on (date+1),
I have to retrieve that record (the straddle record). Then, I look to see if any other records have a Start_DTM which is identical to the Finish_DTM of
the straddle record. If I do, I take that record's Finish_DTM and try to
find a record which has a Start_DTM identical to that record's Finish_DTM.
Once the continuation stops, the query stops. Hence, I disregard the record
that has Start_DTM (date+1)04.30 because it is later than any previous Finish_DTM that can link it back to (date).
Still with me? congrats!

So.. I am aware of various conditional T-SQL (IF...ELSE, WHILE etc) but
these seem to base their conditions on single items (like an average < 15).

I would like to write a stored procedure to get this data. At the moment, all
I can think of is to set up a temporary table (SQL Server 2000) and add
records to it as I see fit (or add 3 days data and remove as see fit).

I am not aware of how temporary tables affect performance. My goal is
to have a DataAdapter which runs the stored procedure to fill a dataset,
which I will ultimately bind to a WinForms control....

What are my chances? Any tips greatly appreciated!!!
Cheers
John
QuestiondBASE Technical Specification? Pin
Mark Sanders24-Apr-03 3:30
Mark Sanders24-Apr-03 3:30 
AnswerRe: dBASE Technical Specification? Pin
Anonymous24-Apr-03 7:04
Anonymous24-Apr-03 7:04 
AnswerRe: dBASE Technical Specification? Pin
David Salter24-Apr-03 22:43
David Salter24-Apr-03 22:43 
AnswerRe: dBASE Technical Specification? Pin
STW27-Apr-03 10:44
STW27-Apr-03 10:44 
GeneralConnection Pooling Problem Pin
John Honan24-Apr-03 2:15
John Honan24-Apr-03 2:15 
GeneralRe: Connection Pooling Problem Pin
John Honan24-Apr-03 8:14
John Honan24-Apr-03 8:14 
GeneralMSAccess Column Format property Pin
KalliMan23-Apr-03 4:09
KalliMan23-Apr-03 4:09 
GeneralODBC support in Visual Studio.net 2003 Pin
aaronflaugh22-Apr-03 10:56
aaronflaugh22-Apr-03 10:56 
GeneralRe: ODBC support in Visual Studio.net 2003 Pin
jscroft25-Apr-03 17:10
jscroft25-Apr-03 17:10 
GeneralProblem with Master Detail Pin
Anonymous22-Apr-03 8:57
Anonymous22-Apr-03 8:57 
GeneralUsing mySQL Pin
BadJerry22-Apr-03 7:25
BadJerry22-Apr-03 7:25 
GeneralRe: Using mySQL Pin
Anonymous24-Apr-03 7:06
Anonymous24-Apr-03 7:06 
GeneralRe: Using mySQL Pin
J. Dunlap24-Apr-03 7:45
J. Dunlap24-Apr-03 7:45 
GeneralRe: Using mySQL Pin
perlmunger30-Apr-03 7:08
perlmunger30-Apr-03 7:08 
GeneralRe: Using mySQL Pin
Jean-Marc Molina29-May-03 13:46
Jean-Marc Molina29-May-03 13:46 
GeneralRe: Using mySQL Pin
perlmunger29-May-03 13:53
perlmunger29-May-03 13:53 
GeneralRe: Using mySQL Pin
Jean-Marc Molina29-May-03 13:54
Jean-Marc Molina29-May-03 13:54 

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.