Forum Replies Created

Viewing 15 posts - 376 through 390 (of 557 total)

  • RE: Chain of tables.

    Grant Fritchey (6/16/2014)


    If filtering on tableA is what you needed, just do that. The INNER JOIN will take care of the rest.

    Thanks for you response, offcourse this was a 'simplyfied'...

  • RE: Distribution of data, percentile curve.

    Hello all,

    Thanks for your contributions and sorry for not responding.

    This weekend I had a fall and have a head injuri. In a few days time everything should be back...

  • RE: Find rows in table A which do not exist in table B.

    gbritton1 (4/25/2014)


    Assuming A and B have the same schema:

    select * from A

    except

    select * from B

    Thank you this is exactly what I was looking for.

    Ben

    LutzM (4/25/2014)


    By definition, there is no "first...

  • RE: Random fill.

    mister.magoo (4/21/2014)


    The problem I see with a truly random fill is that you need to select one value from 4000 for each of 700,000 source rows, so I can see...

  • RE: Random fill.

    J Livingston SQL (4/19/2014)


    maybe food for thought....

    the random data is a bit simplistic...but relatively large.

    not sure if this meets your requirements.

    First thanks for your contribution.

    In your solution, the Target table...

  • RE: Random fill.

    J Livingston SQL (4/19/2014)


    [p](Code is used for more than 60 or 70 tables in three different databases).

    [/p]

    out of curiosity....whats the reasoning behind this proc?

    Code is used for several reasons.

    Mostly to...

  • RE: Random fill.

    mister.magoo (4/19/2014)


    Yes, I can see that taking a long time as it is performing the outer apply ( selecting 1 from 4000 ) for each of the 700000 target...

  • RE: Random fill.

    mister.magoo (4/19/2014)


    Like I said, I couldn't guarantee it, although on the test data you supplied, it worked for me where the other methods failed.

    You definitely used an outer apply, and...

  • RE: Random fill.

    mister.magoo (4/19/2014)


    Try this...simply referencing a column from the target table in the APPLY, using OUTER instead of CROSS and updating the referenced column as well forces the randomisation to work...

  • RE: Random fill.

    spaghettidba (4/19/2014)


    Oh, I see what you mean.

    Try this:

    Tried the solution.

    And I am trying to understand the solution.

    First the solution does not work if the target table is larger than the...

  • RE: Random fill.

    spaghettidba (4/18/2014)


    Well, it worked on the sample data you provided.

    If you gave us more significant sample data, maybe someone could come up with something better.

    Both tables where of the same...

  • RE: Random fill.

    print '-- Start of use_value.full_name_txt : '+convert(varchar(30),getdate(),126)

    --

    -- Get the max from the use_value table.

    --

    declare @Max_number int

    select @max_number = count(*) from use_value

    print 'number use_value, full_name_txt :'+convert(varchar(10), @max_number)

    ;

    WITH

    T...

  • RE: Random fill.

    ben.brugman (4/18/2014)


    spaghettidba (4/18/2014)


    WITH T1 AS (

    SELECT *, randowCol = NEWID()

    FROM Target

    ),

    T2 AS (

    SELECT *, RN = ROW_NUMBER() OVER (ORDER BY randowCol)

    FROM T1

    )

    UPDATE T2

    SET full_name_txt = (SELECT column1 FROM Use_value V...

  • RE: Random fill.

    spaghettidba (4/18/2014)


    WITH T1 AS (

    SELECT *, randowCol = NEWID()

    FROM Target

    ),

    T2 AS (

    SELECT *, RN = ROW_NUMBER() OVER (ORDER BY randowCol)

    FROM T1

    )

    UPDATE T2

    SET full_name_txt = (SELECT column1 FROM Use_value V WHERE...

  • RE: Random fill.

    ScottPletcher (4/18/2014)


    You don't want to modify the target table structure, as that will have lots of overhead.

    Actually adding a RND column to the table, using it and removing it hardly...

Viewing 15 posts - 376 through 390 (of 557 total)