Viewing 15 posts - 2,791 through 2,805 (of 7,614 total)
I'm guessing the ParentTaskCd is used to link the tasks together. Naturally adjust the code as needed to get the specific results you need, but this is a general way...
June 18, 2019 at 8:54 pm
Assuming you don't have dates before 1980, then:
SELECT TOP (100) PERCENT DATEADD(MINUTE, ROUND(DATEDIFF(SECOND, base_date, DateTime) / 10.0, 0) * 30, base_date) AS Date_Time, SUM(Burner1) AS Burn1
FROM dbo.tblOilBurner
CROSS...
June 18, 2019 at 8:32 pm
Here's a sample function using a physical tally table (it's not worth the trouble to me to try to use an inline tally table within a scalar function). I've put...
June 14, 2019 at 10:24 pm
Don't know if it's officially deprecated, but it has lots of issues, so, yeah, probably better to stick to decimal.
As to as_of_month, you'd be better off converting that to go...
June 14, 2019 at 8:26 pm
...
June 14, 2019 at 7:29 pm
select * from table where sportyear=DATEADD(YEAR, -1, @year)
June 14, 2019 at 2:11 pm
Please be more specific on "Does not work" for Q.ArrangementType. In general you should have no problem referencing columns in the view in a NOT EXISTS, so some other error...
June 13, 2019 at 2:01 pm
If you're truly on SQL 2016+, as you said, you can use SESSION_CONTEXT, as below.
It's easier if the tables have the exact same structure, but we could "fudge" around it...
June 12, 2019 at 6:22 pm
Oops, yep, sorry. A copy/paste where I accidentally left the ", 0" at the end.
June 12, 2019 at 5:33 pm
Something along these lines:
Declare @jan01 date
Set @jan01 = Dateadd(Year, Datediff(Year, 0, GETDATE()), 0)
select
Case Left(PeriodID, 3)
When 'Jan' THEN Dateadd(Day, -1, Dateadd(Month, 1, @jan01), 0)
When 'Feb' THEN Dateadd(Day, -1,...
June 12, 2019 at 4:08 pm
Use just one date for each month; in keeping with "standard" practice, I use the first of the month.
Also, you must remove H.Quantity from the GROUP BY.
select...
June 12, 2019 at 2:11 pm
Again, MS is following the relational model, where a set does not have a defined order. That may be fine theoretically, but in the real world we often do need...
June 11, 2019 at 7:42 pm
Here's another alternative to splitting, to show how CROSS/OUTER APPLY can assign alias names to computed values that can be used in subsequent APPLYs and in the SELECT itself, without...
June 11, 2019 at 2:23 pm
Presumably MS is following relational theory, where the order of a set doesn't matter.
But, in the real world, the order often does matter a lot, especially when the set has...
June 10, 2019 at 9:01 pm
Note that you don't have to drop the index and re-create it.
Instead you can DISABLE it, then REBUILD it.
ALTER INDEX no_dups_index ON dbo.your_table DISABLE;
UPDATE your_table
SET ... = ... + 5
/*WHERE...
June 10, 2019 at 4:38 pm
Viewing 15 posts - 2,791 through 2,805 (of 7,614 total)