Forum Replies Created

Viewing 15 posts - 376 through 390 (of 4,081 total)

  • RE: Streaming itvf in CLR to replace special characters

    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...

  • RE: Last day of month in a WHERE clause

    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...

  • RE: Last day of month in a WHERE clause

    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. ...

  • RE: Last day of month in a WHERE clause

    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...

  • RE: Last day of month in a WHERE clause

    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...

  • RE: Last day of month in a WHERE clause

    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...

  • RE: Count the occurrence of word in a Resume Table

    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...

  • RE: sql server 2016 - Grant Fritchey

    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...

  • RE: Table of Dates in TSQL

    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...

  • RE: Select within Case Statement

    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...

  • RE: Select within Case Statement

    Use of a variable in a query keeps it from running in parallel?

  • RE: Select within Case Statement

    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?...

  • RE: Sum 4 weeks sale amount into month

    -- 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...

  • RE: Full-Text Indexing & Searches

    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...

  • RE: Finding related records within the same table

    Hey Jeff, are you going to use your Hierarchies on Steroids approach? 🙂

Viewing 15 posts - 376 through 390 (of 4,081 total)