Viewing 15 posts - 256 through 270 (of 699 total)
Actually John, that was a fortunate coincidence, since it was actually part of the requirements to ignore any extra hours at the start or end of the day. I was...
October 11, 2011 at 6:10 am
Yeah that will work provided your input query isn't anything complex.
But if you start having more complex queries in your execute SQL statement, you may encounter an error because the...
October 7, 2011 at 1:35 pm
Are you trying to write an Execute SQL task and using @ProductionBeforeCount directly?
If so, it won't work, because it doesn't exist within the scope of that task.
What you can do...
October 7, 2011 at 12:19 pm
As a possible suggestion, maybe try putting in a few Execute SQL tasks instead of trying to do it all in one?
Have three execute SQL Tasks:
SELECT COUNT(*) AS 'ProdCount' FROM...
October 7, 2011 at 11:59 am
Indeed - it's for some special calculations at the company I'm working at.
In the end I got the system working, using a similar query to the one that I posted...
October 7, 2011 at 11:42 am
You might want to consider doing it in two steps then. First, set up the table schema on your new system, and then use a bulk load to transfer the...
October 7, 2011 at 9:36 am
Excellent, tested it with a second user, and it still works, after a few minor modifications (in bold):
CREATE TABLE #PlannedHours
(
ID INT IDENTITY PRIMARY KEY,
UserID INT,
[TimeStart] SMALLDATETIME,
[TimeEnd] SMALLDATETIME,
[Type] TINYINT
)
CREATE TABLE #ActualHours
(
ID...
October 6, 2011 at 1:53 pm
Ah good call - forgot I had modified my data set when I was experimenting with different options. Perfect, that works! Thanks!
October 6, 2011 at 1:37 pm
That one unfortunately gives me a result of 92 minutes, while the actual result should be 62 minutes.
October 6, 2011 at 1:23 pm
That's pretty much the exact problem scenario I just painted in my last post drew 😛
Still thinking about how I can handle that. Haven't come up with an answer yet.
October 6, 2011 at 11:59 am
Mm.. yeah I'll worry about tackling the multiple UserIDs after.
Discovered a problem though:
Let's say I change the data to this:
INSERT INTO #ActualHours([UserID], [TimeStart], [TimeEnd])
VALUES (1, '2011-09-27 08:00:00', '2011-09-27 10:30:00') --...
October 6, 2011 at 10:42 am
Yeah I know what you mean Sean. Unfortunately, no, I don't have anything like that.
But I wonder if this solution would work:
WITH cte AS
(
SELECT
#ActualHours.UserID,
#ActualHours.TimeStart,
#ActualHours.TimeEnd,
ABS(DATEDIFF(mi, #PlannedHours.TimeStart, #ActualHours.TimeStart)) AS StartDiff,
ABS(DATEDIFF(mi,...
October 6, 2011 at 10:22 am
Yeah it would be a sum of the differences - the minutes which are out of sync with the schedule that the person should be working. The 15 minutes over...
October 6, 2011 at 10:14 am
In this case Drew, it's supposed to be a sum of both the times that the person worked when they were not supposed to, and also didn't work when they...
October 6, 2011 at 9:40 am
Yeah sorry looking at the data I realise that I made a mistake on that record. It should be:
INSERT INTO #PlannedHours ([UserID], [TimeStart], [TimeEnd], [Type])
VALUES (1, '2011-09-27 08:00:00', '2011-09-27 09:45:00',...
October 6, 2011 at 9:39 am
Viewing 15 posts - 256 through 270 (of 699 total)