Forum Replies Created

Viewing 15 posts - 17,881 through 17,895 (of 59,069 total)

  • RE: I need a strange join, please help

    GSquared (4/11/2016)


    If the business defines "closest in time" as what they want to match, then it's not wrong.

    I have to disagree with that in a lot of cases. I...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Master.dbo.SysColumns

    GilaMonster (4/12/2016)


    Jeff Moden (4/12/2016)


    John Mitchell-245523 (4/12/2016)


    It's the old-style join syntax. These two are equivalent:

    ...

    FROM TableA, TableB

    ...

    FROM TableA CROSS JOIN TableB

    ... as are these two:

    ...

    FROM TableA, TableB

    WHERE TableA.ID = TableB.ID

    ...

    FROM...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Master.dbo.SysColumns

    cad.delworth (4/12/2016)


    Well I never! I genuinely didn't know that.

    John: you're a star, and thanks.

    Clearly my SQL education has been so Prim and Proper that I have never ever been...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Master.dbo.SysColumns

    John Mitchell-245523 (4/12/2016)


    It's the old-style join syntax. These two are equivalent:

    ...

    FROM TableA, TableB

    ...

    FROM TableA CROSS JOIN TableB

    ... as are these two:

    ...

    FROM TableA, TableB

    WHERE TableA.ID = TableB.ID

    ...

    FROM TableA INNER JOIN...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: SQL Server diagram - table in other DB

    Thank YOU for the feedback on what you're doing. It's great to have some insight as to the needs of others.

    For what it's worth, I also sometimes run across...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: I need a strange join, please help

    J Livingston SQL (4/11/2016)


    It would be appreciated if the OP can post some sample data etc.

    if there are millions of rows as suggested then it would be good to see...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: SQL Server diagram - table in other DB

    ttdeveloper (4/11/2016)


    Hey Jeff

    Thanks for this suggestion. I did consider using triggers across our databases but one reason has me worried about this.

    Performance. Our design essentially will be querying...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: I need a strange join, please help

    Hugo Kornelis (4/10/2016)


    Without CREATE TABLE and INSERT statments I cannot test anything, but my gut feeling is that you will end up with a pattern somewhat like the below:

    SELECT List,...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Third Party Backup - Asigra - experience

    Ed Wagner (4/10/2016)


    I have no experience with Asigra at all, but I'm a fan of using native SQL backups. That's what we use and they haven't failed me yet.

    Ditto...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Code smells versus transgressions

    Heh... ok... I take it back. I was asked to troubleshoot some problems in some code I've never seen before and I now even hate XML used for configuration...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Calculate Age (in years)

    From the Article:


    See Comments in the code for more details.

    Awesome. I don't very often see such a useful bit of header information. You've provided a succinct yet accurate...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Restore help needed for 1.5 TB database.

    xsevensinzx (4/9/2016)


    jay81 (3/31/2016)


    Use Backup file Striping with the methods described in the below blog. I could reduce to backup times from few hours to with in an hour for large...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: SQL Server diagram - table in other DB

    I believe I'd be tempted to use a trigger to do inter-database referential integrity. Specifically, an "Instead of" trigger. From BOL...

    [font="Arial Black"]DML Triggers[/font]

    DML triggers are frequently used for...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: SQL Server diagram - table in other DB

    ttdeveloper (4/8/2016)


    Good Morning Happy

    Great suggestion on the UDF. To be honest i didnt think about that option. Ill give it a shot this morning and see what the outcome is....

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Convert string nvarchar(6) with format MMM-YY to date

    Lynn Pettis (3/29/2016)


    Just seems a little cleaner:

    with ConvertDate as (

    select cast('01-' + string as date) DateValue

    from (values('Dec-15'),('Jan-16'),('Feb-16')) test_data(string)

    )

    select datename(month, DateValue) + ' ' + datename(year, DateValue) MonthYear from ConvertDate;

    I absolutely...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 17,881 through 17,895 (of 59,069 total)