Viewing 15 posts - 3,826 through 3,840 (of 5,504 total)
Here's another version.
Side note: instead of expanding it to 24hrs per day I just used the hours between noon and 10pm. If you need all 24hrs, you'd need to change...
April 9, 2010 at 2:13 pm
Your reply doesn't really answer the question on how to actually calculate the working hours.
Your sample data do make room for some interpretation... Also, your desired result is an integer...
April 9, 2010 at 1:08 pm
Please provide table definition, sample data and expected result in a ready to use format as described in the first link in my signature.
That would make it easier for us...
April 9, 2010 at 12:44 pm
I would use a calendar table (holding the day values), expand it to cover 24hrs per day (or the possible working hours) and join that to the ShiftData table.
Something like...
April 9, 2010 at 12:42 pm
Please provide table def and sample data that correspond to your expected result in a ready to use format as described in the first link in my signature.
April 9, 2010 at 11:33 am
Glad I could help! 😀
April 9, 2010 at 11:16 am
I'm not sure if it helps but you could try to enforce a specific collation within the CASE statement:
SELECT
CASE
...
April 8, 2010 at 4:17 pm
Please provide some more information.
What would be great would be some sort of ready to use sample data as described in the first link in my signature.
In your case it...
April 8, 2010 at 11:41 am
You would need to use dynamic SQL for that:
Here's an example:
DECLARE
@list VARCHAR(30),
@SQLString NVARCHAR(200)
SET @list ='''Bothell'',''Portland'''
SET @SQLString = N'SELECT * FROM Person.Address WHERE city in('+@list+')'
EXEC sp_executesql @SQLString
April 8, 2010 at 11:36 am
I just have a headline for SSC jumping into my mind:
Having trouble with your database or your kids?
Have a look at SSC! We'll tune both! 😀 :hehe: 😀
April 7, 2010 at 5:59 pm
CirquedeSQLeil (4/7/2010)
...Funny - exercising restraint to not use a 1-liner on that.
Brave man. Do you want us to consider it some kind of self-flagellation? 😀
April 7, 2010 at 5:46 pm
Grant Fritchey (4/7/2010)
You kids take this outside or I'm going to get my belt!
If there's any masochist involved you just called to continue :w00t:
Side note:
@jason: no matter how long your...
April 7, 2010 at 5:32 pm
GregoryF (4/7/2010)
I think you have gone way beyond the scope of someone who asked what the difference between delete and truncate is 🙂 Don't confuse them while they are...
April 7, 2010 at 5:13 pm
You might want to look into ROW_NUMBER together with CTEs. There are several solutions available on this site. Please search for "duplicate rows" in the scripts section.
April 7, 2010 at 5:05 pm
Do you know the max number of cross joins ahead of time?
What I'd probably do in this case is to build a static table like the one I posted covering...
April 7, 2010 at 5:00 pm
Viewing 15 posts - 3,826 through 3,840 (of 5,504 total)