July 23, 2012 at 11:16 am
I am trying to write a script that will calculate overtime hours by day. There will be a column that will have Potential Overtime house based on each 8 hour day...for example Monday I work 10 hours so the potential overtime will be 2 hours. On Tuesday I work 7 hours so the potential hours will be 1 (Monday 10 hours - Tuesday 7 hours)
I have a stored proc however the system we are trying to put it in does not allow stored procs so I need to place it in a script. Can someone please help
July 23, 2012 at 11:30 am
Hi and welcome to SSC. We are willing and able to help but first you have to provide enough information for somebody to be able to help. You need to at least post ddl, sample data and desired output. Take a look at the first link in my signature for best practices when posting questions.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
July 23, 2012 at 11:32 am
Looking closer at your issue it seems you need a running total. Take a look at this article. http://www.sqlservercentral.com/articles/T-SQL/68467/%5B/url%5D
It is a great article and a must read on the topic.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply