Forum Replies Created

Viewing 15 posts - 16,861 through 16,875 (of 59,101 total)

  • RE: Urgent!!Need to write a sql script

    patilpallavi16 (9/13/2016)


    I have the following sql query:

    declare @naiccode int = 12345

    SELECT Policy.policyType, Policy.policyNum, Policy.effectiveDate, '12345' AS "NAIC Code" ,

    Insured.lname1, Insured.middle1,

    Insured.fname1, Insured.address1, Insured.city, Insured.state, Insured.zip FROM Policy FULL JOIN

    Insured ON...

    --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: A Case FOR Cursors...

    Hugo Kornelis (9/12/2016)


    What I should have written was "a WHILE loop, no matter how well written it is, will never ever beat a (well written) cursor".

    Do you have some readily...

    --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: Down Tools Week 2016

    From the Article:


    An organization wouldn't need to cater food every night.

    Night? Free brainstorming for the company and it's at night?

    I've heard of "Down Tools" or "Down Weeks" before but there's...

    --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: Temporary tables

    That is unless the temp table starts with two "#" signs, which makes it a "Global Temp Table", and then the answer would be "yes".

    --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: Random Unique Number Always

    amy26 (9/14/2016)


    Thank you so much! Perfect!

    Curiosity question please. Which method did you 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: Random Unique Number Always

    Eirikur Eiriksson (9/14/2016)


    Jeff Moden (9/14/2016)


    Eirikur Eiriksson (9/13/2016)


    First few rows of the output (wich obviously will not be the same again)

    Not guaranteed to be true, though. Because of the translations,...

    --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: Add million of records

    sqlenthu 89358 (9/14/2016)


    Hi all, I have to transfer around 50 million records from one table to another. What should be the best approach. I know it can be done batchwise...

    --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: recovery mode comparison

    The nest questions would be.... do you have anything in the database that you couldn't easily recreate and are you backing up the database on a very regular basis.

    --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: Split a string on Commas - except when it has a numeric character immediately on either side of it

    Best way to fix this is to have a pork chop dinner with the people that are providing the data. 😉

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

    dallas13 (9/14/2016)


    Once again Thanks a lot.

    Jeff- I understand your concern but we have data coming from third party so we have to massage data here.

    The Dixie Flatline- You are right....

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

    dallas13 (9/14/2016)


    Thanks a lot guys. However I tried this approach

    CREATE TABLE #UnPivotExample(code varchar(2), value int)

    INSERT INTO #UnPivotExample (code,value)

    SELECT code,value

    FROM

    (SELECT [AZ], [NY], [PA] FROM #Example

    ) AS cp

    UNPIVOT

    ...

    --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: Random Unique Number Always

    Eirikur Eiriksson (9/13/2016)


    First few rows of the output (wich obviously will not be the same again)

    Not guaranteed to be true, though. Because of the translations, as unlikely as it...

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

    Jason A. Long (9/13/2016)


    Try this...

    IF OBJECT_ID('tempdb..#Example','U') IS NOT NULL

    DROP TABLE #Example;

    CREATE TABLE #Example (

    id INT,

    AZ INT NULL,

    NY INT NULL,

    PA INT NULL

    );

    GO

    INSERT#Example (id,AZ,NY,PA) VALUES (1, '5','7','5'),(2, '2','3','5'),(3, '3','2','5');

    SELECT

    e.id,

    x.State,

    x.Value

    FROM

    #Example e

    CROSS...

    --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: Best way for dynamic partitioning of table sql server

    Thanks, Steve. I really appreciate the time you took to explain that. You folks definitely put some thought into 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: Random Unique Number Always

    amy26 (9/13/2016)


    Hello, I have a stored procedure that will be executing on a recurring basis at different intervals. There is a field that I need to populate with a...

    --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 - 16,861 through 16,875 (of 59,101 total)