Forum Replies Created

Viewing 12 posts - 1 through 12 (of 12 total)

  • RE: The Worst Comments

    I worked on a project we just about every program had a comment in it which read

    // Jim QQQ is a moron

    Jim QQQ was a'programmer' whose brother owned the...

  • RE: SQL Battleship

    39 shots! First game win. Lost in 38 second game. Great job!

  • RE: I have no id

    Thanks. You are right about using integers for dates. Just got lazy.

  • RE: I have no id

    david.gugg (12/16/2014)


    So as it is currently written, is the query actually doing this?:

    SELECT s.*

    FROM dbo.Stocks s

    WHERE s.id IN ( SELECT s.id

    ...

  • RE: I have no id

    Oops. Sorry about leaving the dbo in there. That could be the topic of a good QotD. That can be a nasty, hard to find issue.

  • RE: I have no id

    Short answer, yes, the WHERE clause could be left out. Thanks for pointing that out.

    Long answer: It's usually a bug. The idea is that you are trying to link...

  • RE: Fun with XOR #2

    I was unhappy with the whole question because I was sure I got the math right. Then I read some of the other comments and realized that ^ means something...

  • RE: In vs =, performance considerations

    Yes. Looking at the execution plan, it is using the index for both options.

  • RE: In vs =, performance considerations

    That's the way I am leaning. After reading a bit, it appears that SQL Server engine will try to optimize the order of the items in the 'IN' clause. This...

  • RE: Get month days

    Wow. That's pretty compact. Thanks for sharing.

  • RE: Get month days

    I ran both versions against a DB table with about 1.2 million rows.

    Without the get days it took 35 seconds.

    With Igor's version it took 39 seconds.

    With my version it...

  • RE: Get month days

    CREATE FUNCTION dbo.fnGetMonthDays(@myDate DATETIME) RETURNS INT

    AS

    BEGIN

    return DATEDIFF(d, DATEADD(month, DATEDIFF(month, 0, @mydate) , 0) ,DATEADD(d, -1, DATEADD(m, 1, DATEADD(month, DATEDIFF(month, 0, @mydate) , 0)))) + 1

    END

    go

    select...

Viewing 12 posts - 1 through 12 (of 12 total)