Forum Replies Created

Viewing 15 posts - 27,346 through 27,360 (of 59,101 total)

  • RE: Better logic than cursor

    Compassionate (3/2/2013)


    Hi All,

    I have two tables Tab1 and Tab2.For each row in Tab1, the table Tab2 contains multiple rows.Important columns in both tables are C0,C1 and C2. So i have...

    --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: even and odd records

    mehta.saurabhj (3/2/2013)


    The sql code to find odd number of records is:

    select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);

    But if I do the foll code for odd...

    --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: Using a Variable for an IN Predicate

    Irozenberg 1347 (3/1/2013)


    Thank you Jeff!

    IMHO CSV data in database is a pure hack - some developers just cutting corners to speed up first cut and leave before it causing HUGE...

    --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: UDF Help

    Yeah, you're right, Kevin. I should'a'node. 🙂 The "symptoms" told me I should ask anyway. Didn't know the "problem" would be such an incredible machine. Thanks...

    --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: few clarifications in coverting date to string literals

    manibad (3/1/2013)


    I need to work on SSIS in converting date format to string literals.

    1)Input:2013-03-01

    Output:03-March-2013

    2)First day of the following month

    Input:2013-01-01

    Output:2013-02-01

    (or)

    input:2013-12-29

    Output:2014-01-01

    I need to satisfy both conditions in a single query

    I need...

    --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: BCP

    Lowell (3/1/2013)


    Sigerson (3/1/2013)


    @Lowell,

    Is there a word for having to learn so many fine points that one begins to forget the basics? :ermm:

    Oh yea,the only guys that remember it all,...

    --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: Denormalising report from normalised nested source data

    @gavin.cox,

    First, very nice job on providing readily consumable data.

    My question to you is, will there only be 3 levels in this data?

    Also, please post the code you used for your...

    --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: How to make a Pivote table

    No answer in 14 hours. Take a look at the article at the first link in my signature below for a way to change that.

    --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: DateTime Rows to Columns

    You were SO close...

    SELECT

    U.Num,

    U.NAME,

    [1] = SUM(CASE WHEN MONTH(W.WorkDay) = 1 THEN W.TimeWorked ELSE 0 END),

    [2] = SUM(CASE WHEN MONTH(W.WorkDay) = 2 THEN W.TimeWorked ELSE 0 END),

    [3] = SUM(CASE WHEN...

    --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: Physically stapling ssrs report when printing

    drjahns 71679 (3/1/2013)


    How do you staple ssrs report pages when printing?

    It's not a function of SSRS. It's a function of the automatic stapler on your printer and can normally...

    --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: Select full month number (with 0)

    ScottPletcher (3/1/2013)


    Or simply:

    SELECT CONVERT(char(2), myDate, 1)

    I'm not poking holes here so go easy. Considering another conversation about not so obvious code, wouldn't the concatenation method of adding a zero...

    --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: Joins

    You can avoid 2 of the 3 table scans of Table1 with a brute force "uncrosstab" (unpivot) followed by a cross tab (pivot). I haven't tested it for performance...

    --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: Adding a Table Lock on Purpose

    As Magoo suggests, if you include the UPDATE and SELECT in a single transation, then only people that did the end-around with things like WITH(NOLOCK) or SET TRANSACTION ISOLATION LEVEL...

    --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: UDF Help

    TheSQLGuru (3/1/2013)


    Jeff Moden (3/1/2013)


    TheSQLGuru (2/28/2013)


    I would honestly expect (but not certain here) that a scalar UDF that just puts it's output into a variable would be more efficient than iTVF...

    --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: UDF Help

    Alan.B (3/1/2013)


    This is something I need to play around with more. I took what Jeff said to imply that, in the code below, the iTVF function (nsq_iTVF) would be faster...

    --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 - 27,346 through 27,360 (of 59,101 total)