Viewing 15 posts - 3,406 through 3,420 (of 10,144 total)
vignesh.ms (4/30/2014)
...But My real time table have 13 digit nos. It through Arithmetic overflow error
Please provide some realistic sample data so that folks attempting to help won't have the same...
April 30, 2014 at 6:07 am
Assuming you are referring to the ORDER BY clause, then visualising the result of those CASEs will help:
DROP TABLE #OFFICES
CREATE TABLE #OFFICES (
OFFICEID INT NOT NULL,
OFFICENAME VARCHAR(100),
HEADOFFICEID INT
)
INSERT INTO #OFFICES...
April 30, 2014 at 2:01 am
On second thoughts, Thava's query appears to do the trick - the boundary between daily OT and weekly OT isn't total hours, it's regular hours. My query becomes this:
-- Daily_OT...
April 29, 2014 at 6:27 am
'01/06/2014', '14.25', 'Monday'-- REG = 8.00, DAILY_OT = 6.25, WEEKLY_OT = 0.00, TOTAL HOURS = 14.25
'01/07/2014', '12.25', 'Tuesday'-- REG = 8.00, DAILY_OT = 4.25, WEEKLY_OT = 0.00, TOTAL HOURS =...
April 29, 2014 at 3:49 am
-- SPI CPI - Programscores
SELECT
a.ProgramId, a.Tier4Id, a.[DATE],
SPI= a.Value7,
SPI_H= CASE
WHEN a.[Value7] IS NULL OR ISNULL(m7.[IsGoalOriented],0) = 0 THEN 5 /*OR MBM.fn_CheckGoalsAvailability(A.MetricId) = 0 */
WHEN a.[Value7] BETWEEN...
April 28, 2014 at 5:52 am
“Peel one potato at a time” as Jeff says. Firstly, separate out the source query from the MERGE statement. What you notice with this simplification - cutting down only...
April 28, 2014 at 4:43 am
jhinch (4/23/2014)
April 24, 2014 at 8:52 am
mlwiller2 (4/24/2014)
IF ((SELECT DATEPART(MONTH, GetDate())) = 04)
UPDATE
db1
SET
...
April 24, 2014 at 7:12 am
And while you're doing that, don't forget the effect of wrapping functions around columns in your WHERE clause (or joins)
WHERE S.LSKINdicator = 1
AND S.ProjectId IS NOT NULL
/*AP3-820 Check for...
April 24, 2014 at 7:04 am
mlwiller2 (4/24/2014)
If DATEPART(Month,Datetime) = 04
...
April 24, 2014 at 6:57 am
Your sample indicates that table1 is an exact copy of two columns of table2 - is this really the case?
Here's one way to do what you want, if table1 is...
April 24, 2014 at 5:19 am
Lynn Pettis (4/23/2014)
I have downloaded and looked at both of the latest sqlplans, both use the same index due to the use of the WITH(INDEX(AI_OperatorCBGEstimate_HAP)) index hint on the query.
File...
April 24, 2014 at 2:07 am
The two CROSS APPLY blocks collect the column lists. FOR XML PATH concatenates the lists into a string. You can read about APPLY in the two excellent articles by Paul...
April 23, 2014 at 9:17 am
Why did you create two identical indexes?
How many environments do you have which will run this query?
April 23, 2014 at 6:42 am
Can you present the user with a list of relevant tables? If not, you could check the passed-in tablename against a list.
April 23, 2014 at 6:16 am
Viewing 15 posts - 3,406 through 3,420 (of 10,144 total)