Forum Replies Created

Viewing 15 posts - 40,501 through 40,515 (of 59,072 total)

  • RE: Need query

    freeman.e.l (12/24/2009)


    declare @start_date datetime

    declare @end_date datetime

    declare @diff int

    set @start_date = '3/9/2009'

    set @end_date = '3/13/2009'

    set @diff = datediff(dd,@start_date,@end_date)

    create table #Results ([Month Start] datetime, [Month End] datetime, [Total Days] int, [Amount] money)

    insert...

    --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: Need query

    I haven't check the rest of your good post, but don't ever use @@IDENTITY... if a trigger is ever place on the table in question, @@IDENTITY will return incorrect answers....

    --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: CLR Table-Valued Function Example with Full Streaming (STVF)

    Thanks for the feedback, Solomon. Glad to see folks using it for smart stuff.

    As a side bar, Matt Miller and I had some friendly races a couple/three years ago...

    --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: Create a new column with criteria

    Biz (12/23/2009)


    Hi Jeff,

    Thats working... Was thinking to sort it dynamically and then do this.

    But this is really easy..

    Thanks

    Merry Xmas..

    Thanks for the feedback. "Easy" is good. 😉 Shifting...

    --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: CLR Table-Valued Function Example with Full Streaming (STVF)

    Next question, please... What application would have the need for such a thing where it could not be done using T-SQL? Not trying to be a smart guy...

    --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: Help with a datediff calc

    Paul Morris-1011726 (12/23/2009)


    hmmm ... I was reading Jeff Moden's article about Forum Etiquette: How to post data/code on a forum to get the best help and was wondering, am providing...

    --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: @@identity bring back wrong number

    roundel1900 (12/23/2009)


    I have an insert procedure with @@identity set to an output variable. The output variable is bring back a number nowhere near the max id column. The max id...

    --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: CLR Table-Valued Function Example with Full Streaming (STVF)

    ...but I wanted to create TVFs so that I could more easily interact with the output by doing WHERE conditions, GROUP BYs, ORDER BYs, etc. which are not possible with...

    --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: Create a new column with criteria

    Biz (12/22/2009)


    Hi Guys,

    I am still modifying this, though it is giving the serial number, I need to get the order of the serial number by the [course start date].

    So trying...

    --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: Looking for some fundamental help automating a query

    Ah... I see the problem. The alter table does not happen at compile or run time. It happens when it is actually executed. The only way 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: Compare documents in folder to items in a table

    TheSQLGuru (12/22/2009)


    I wish xp_dirtree would give enough information to be able to traverse a directory hierarchy. Anyone know how to do that?

    d:\sqlexp\112233

    d:\sqlexp\112233\20091211

    d:\sqlexp\112233\20091212

    d:\sqlexp\112233\20091213

    d:\sqlexp\112233\20091214

    d:\sqlexp\112233\20091215

    d:\sqlexp\112233\20091216

    d:\sqlexp\112233\20091217

    d:\sqlexp\112244

    d:\sqlexp\112244\20091211

    d:\sqlexp\112244\20091212

    d:\sqlexp\112244\20091213

    d:\sqlexp\112244\20091214

    d:\sqlexp\112244\20091215

    d:\sqlexp\112244\20091216

    d:\sqlexp\112244\20091217

    I seem to get the following output 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: i need logic to get the days for most recent week that ends with Friday

    Nabha (12/22/2009)


    Jeff Moden (12/22/2009)


    Sorry... I was still focused on your original post... that code was for only 1 week... this is for 2...

    SELECT DATEADD(dd,DATEDIFF(dd,6,GETDATE()+1)/7*7,-9)+t.Number

    FROM Master.dbo.spt_Values t

    WHERE t.Type...

    --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: SSIS - ForEach From Variable Enumerator

    Heh... I probably wouldn't use SSIS for such a thing. I damned sure wouldn't use a script for this. T-SQL would do the job just fine.

    --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: Data reformatting question

    mmdmurphy (12/22/2009)


    Well, at the risk of getting stoned, I didn't understand these answers that much.

    I found the critical lines in the visual basic script that gets the data, and...

    --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: Are the posted questions getting worse?

    The Dixie Flatline (12/22/2009)


    Bring forth the Holy Pork Chop of Antioch! 😛

    Heh... paraphrased from one of my favorite "B" movies...

    "Glory be to the [Code], and to the Holy [Forum]....

    --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 - 40,501 through 40,515 (of 59,072 total)