Viewing 15 posts - 376 through 390 (of 4,081 total)
Lynn, have you tried using your tally table and substring([input],N,1) to reduce the [input] string to a series of individual characters?
You could put all your special codes to be...
August 12, 2016 at 1:46 pm
I had to change EoMonth('1/1/2016',(N-1)) to EoMonth('1/1/2016',(1-n)) for it to work with dates in the past.
An alternative is to just back up the starting date to cover your date...
August 12, 2016 at 10:21 am
Guys, I'm trying to figure out the disconnect here. I am running against a table of almost 41 million rows using the OPs table description. ...
August 12, 2016 at 9:22 am
After thinking about times being included, we don't need to waste cycles converting Check_Date from datetime to date. We just need to go a little bit more...
August 12, 2016 at 6:44 am
twin.devil (8/12/2016)
There are few issues regarding this solution:
1. This logic will not work if MyDate column have TIME data in it, So MyDate should be cast as date.
I agree it...
August 12, 2016 at 6:32 am
IF you can afford a nonclustered index on check_date, this will drastically reduce the i/o.
;with Eomonths (Eom) as (select top(500) EoMonth(DateAdd(MONTH,(N-1),'1/1/2016')) from tally)
select Eom as Check_date, Total
from Eomonths
cross apply (select...
August 11, 2016 at 8:29 pm
Alan, just out of curiousity, would you be so kind as to test this solution and compare it to your final?
This would have been my knee-jerk...
August 11, 2016 at 2:09 pm
I think Grant and Brandie Tarvin should get together and write fantasy novels about execution plans. 😛
Hey Grant, Is Miskatonic U. going to wind up in the Big...
August 11, 2016 at 9:43 am
One last thing. Questions often come up where a count of days is needed excluding special days. You might find it handy to add a column to...
August 9, 2016 at 12:35 pm
select @Period = dbo.calcperiod(value) from sys_registry where system_code = 'gbl' and name = 'reportdate';
This is my point. The first solution does NOT use the scalar function in the...
August 9, 2016 at 12:31 pm
Use of a variable in a query keeps it from running in parallel?
August 9, 2016 at 12:01 pm
I would look at rewriting the scalar function dbo.calcperiod to a itvf (in-line table valued function) and modify the second option to use it instead of the scalar function.
Why, Lynn?...
August 9, 2016 at 11:43 am
-- query to solve the problem follows
;with cte as (select AreaNo,(WeekNo-1)/4+1 as Week4, count(*) as TotalRows, sum(Amt) as TotalAmt
from #data
group by AreaNo,(WeekNo-1)/4+1
)
-- the added ROLLUP is going to produce...
August 9, 2016 at 11:25 am
The issue with using LIKE is that it will do a complete table or index scan checking every row, unless you are looking for a title or description that starts...
August 8, 2016 at 7:32 pm
Hey Jeff, are you going to use your Hierarchies on Steroids approach? 🙂
August 8, 2016 at 3:28 pm
Viewing 15 posts - 376 through 390 (of 4,081 total)