Viewing 15 posts - 151 through 165 (of 3,543 total)
SELECTt.COUNTRY_CODE,t.COMPANY_CODE,t.ITEM_NBR,t.Department,t.[Week],d.[Day],q.QTY
FROM t
CROSS JOIN (
VALUES ('SUN'),('MON'),('TUE'),('WED'),('THU'),('FRI'),('SAT')
) d ([Day])
CROSS APPLY (
SELECT CASE d.[Day]
WHEN 'SUN' THEN t.SUN_QTY
WHEN 'MON' THEN t.MON_QTY
WHEN 'TUE' THEN t.TUE_QTY
WHEN 'WED' THEN t.WED_QTY
WHEN 'THU' THEN...
September 5, 2019 at 8:12 am
What is the default language for the server?
Don't you mean login as the default language of the login dictates date conversion as described by Thom and could be different...
September 4, 2019 at 7:57 am
Phil's solution is what I would have done.
Just for completeness
SELECTCOUNTRY_CODE,COMPANY_CODE,ITEM_NBR,Department,[Week],[Day],QTY
FROM(
SELECTCOUNTRY_CODE,COMPANY_CODE,ITEM_NBR,Department,[Week],
SUN_QTY,MON_QTY,TUE_QTY,WED_QTY,THU_QTY,FRI_QTY,SAT_QTY
FROM
) p (COUNTRY_CODE,COMPANY_CODE,ITEM_NBR,Department,[Week],
[SUN],[MON],[TUE],[WED],[THU],[FRI],[SAT])
UNPIVOT(
[QTY] FOR [Day] IN ([SUN],[MON],[TUE],[WED],[THU],[FRI],[SAT])
) a;
SELECTt.COUNTRY_CODE,t.COMPANY_CODE,t.ITEM_NBR,t.Department,t.[Week],d.[Day],q.QTY
FROM t
CROSS JOIN (
VALUES ('SUN'),('MON'),('TUE'),('WED'),('THU'),('FRI'),('SAT')
) d ([Day])
CROSS APPLY...
September 3, 2019 at 4:05 pm
I could not see any attachment.
However two samples that may help
SELECTID, DayNo, DayValue
FROM(
SELECTID, Val1, Val2, Val3, Val4, Val5, Val6, Val7
FROM
) p (ID, [1], [2], [3], [4], [5],...
September 3, 2019 at 1:21 pm
Actually, the best thing to do would be to have an "Order_Header" table where the ORDER TYPE only needs to be noted once and then store the details in...
September 2, 2019 at 1:06 pm
Just make sure the number of seconds does not exceed one day otherwise the time will be wrong
August 29, 2019 at 1:08 pm
Don't know Oracle but if the result of your math is number of seconds since midnight then
CAST(DATEADD(second,(626400-432000)/10,0) as time)
August 29, 2019 at 12:49 pm
It's been good. We're still waiting for our baby girl to decide to be born. She's taking her time. (Yesterday was the "due date")
I'm assuming by now...
August 22, 2019 at 7:37 am
I also have AK's, which are also unique and are what you call "natural keys". For me, they exist mostly to enforce the very uniqueness you speak of. ...
August 22, 2019 at 7:30 am
IMHO, you are on the right path. I'm currently doing exactly what you described. Importing flat, delimited files to a 'staging' table where all fields are defined...
August 13, 2019 at 9:18 am
USE LAG instead of SAMPLING_POINT in the select like this
CASE WHEN SAMPLE.SAMPLING_POINT = LAG(SAMPLE.SAMPLING_POINT,1,'') OVER (ORDER BY SAMPLE.SAMPLING_POINT ASC)
THEN ''
ELSE SAMPLE.SAMPLING_POINT
END AS [SAMPLING_POINT]
August 5, 2019 at 12:38 pm
If your temp table is the source of data for your MERGE, you don't need the CTE.
You would if you only wanted to affect a subset of TRANSDETAIL
Otherwise the...
August 5, 2019 at 12:18 pm
You need to produce a cartesion of unique employees (SELECT DISTINCT) and DateRange (CROSS JOIN) and LEFT JOIN the employees table
August 2, 2019 at 12:27 pm
when I drop a column name like Policy_Type into the report, SSRS is smart enough to replace the underscore with a space for the column name on the report.
Actually...
July 25, 2019 at 8:28 am
Viewing 15 posts - 151 through 165 (of 3,543 total)