Forum Replies Created

Viewing 15 posts - 23,026 through 23,040 (of 59,099 total)

  • RE: Loop or similar solution

    P74 (8/3/2014)


    Hi,

    I need help with some code!

    Scenario:

    I know the ContractNumber

    I know the StartDate of a contract (always in the past)

    I know the RentalAmount (fixed for the duration)

    I know the RentalFrequency...

    --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: Converting Hour and Minute to Decimal

    For anyone that would like to do their own testing, here's the test table I've been using for all of this...

    WITH cteRandomDT AS

    (

    SELECT TOP 1000000

    ...

    --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: DBA vs Developer

    TomThomson (8/3/2014)


    Jeff Moden (8/2/2014)


    Grant Fritchey (7/16/2014)


    You mean you didn't flip the infinity switch on your tempdb? That developer is right, you have it configured incorrectly.

    Heh... what's really cool about Grant...

    --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: Index and Page Split

    WhiteLotus (8/3/2014)


    Jeff Moden (8/1/2014)


    You could disable them which drops all of the data from the index but keeps the meta data and see if peformance suffers. Of course, you...

    --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: DBA vs Developer

    Grant Fritchey (7/16/2014)


    You mean you didn't flip the infinity switch on your tempdb? That developer is right, you have it configured incorrectly.

    Heh... what's really cool about Grant is that he...

    --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: Get next primary key without identity

    Erland Sommarskog (8/2/2014)


    Jeff Moden (8/2/2014)


    I agree that SEQUENCE has the advantage of being able to cover multiple tables and that IDENTITY requires SET IDENTITY INSERT if you want to update...

    --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: Converting Hour and Minute to Decimal

    Eirikur Eiriksson (8/2/2014)


    The datetime format is still the same upto and including 2014.

    😎

    Thanks Eirikur. I've never looked at it but figured it might be so. That does, however,...

    --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: Get next primary key without identity

    I agree that SEQUENCE has the advantage of being able to cover multiple tables and that IDENTITY requires SET IDENTITY INSERT if you want to update the identity column but,...

    --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: Converting Hour and Minute to Decimal

    Ed Wagner (7/31/2014)


    It sounds to me like you're after the number of units picked per hour for a specific period of time. It reminds me of a shop floor...

    --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: Converting Hour and Minute to Decimal

    Here's what I'd use to solve this problem on my systems because it's short and accurate with the accuracy limits of DATETIME. No... it's not ANSI/ISO compliant and no......

    --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: Converting Hour and Minute to Decimal

    Sean Lange (7/31/2014)


    Sql server stores datetime as decimal. You can easily cast a datetime to decimal. But what is the point? What are you trying to do with it?

    I use...

    --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: Get next primary key without identity

    Eirikur Eiriksson (8/2/2014)


    Update code

    USE tempdb;

    GO

    SET NOCOUNT ON;

    DECLARE @ITER INT = 0 ;

    DECLARE @COUNT INT = 100000;

    DECLARE @NextId INT = 0 ...

    --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 do I loop through rows and populate data?

    thejordans21 (8/1/2014)


    Here is my data.. (I have around 195K of rows)

    Here is a brief snapshot of it:PLANTPLANT_DESCVENDOR

    NOPENULLNOPE

    7010Coquitlam DCPR1

    NOPENULLNOPE

    NOPENULLNOPE

    NOPENULLNOPE

    NOPENULLNOPE

    NOPENULL1014435

    NOPENULL1014435

    NOPENULL1014435

    NOPENULLNOPE

    NOPENULLNOPE

    NOPENULLNOPE

    NOPENULL1014435

    NOPENULL1014435

    NOPENULL1014435

    What I need to happen is that where...

    --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: Get next primary key without identity

    tshad (7/31/2014)


    I have a table to store int primary keys. Where the value nextID is the value to use.

    I need to get the value and update it (nextID +...

    --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: Importing Poorly Formatted Text File

    Ah... scratch one of those questions. I see that the first section has quite a few extra line types. I do, however, still need to know if the...

    --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 - 23,026 through 23,040 (of 59,099 total)