I need to copy rows from my production table to my test server table

  • so I have a production table  UWPATLEMPSQL01.HYP_FDMEE.tdataseg  and need to move one section of data to my test server  which is the same table  UWTATLEMPSQL01.hyp_fdmee.tdataseg

    This is the code to pull the data from production:
    useUWPATLEMPSQL01.hyp_fdmee

    go

    Selectpartitionkey,catkey,periodkey,DATAVIEW,CALCACCTTYPE,amount,account,ENTITYX

    fromTDATASEGwherepartitionkey = '123' and YEAR(periodkey)='2018'

    Can I just insert the output from production to TEST?  If so how?

    If not what is the best way?

  • Ok so lets try this in steps.  in this example I need to source partitionkey 118 and then load the data back into the same table as partitionkey 123
    So if I was not making any changes I would use this.  But I need the INSERT to be 123
    so how can I update the Insert command to insert all the rows as is, except for PartitionKey ?

    INSERT into TDataseg (partitionkey,catkey,periodkey,DATAVIEW,CALCACCTTYPE,amount,account,ENTITYX)

    Select partitionkey,catkey,periodkey,DATAVIEW,CALCACCTTYPE,amount,account,ENTITYX

    from TDATASEG

    where partitionkey = '118' and YEAR(periodkey)='2018'

  • What is the connectivity between the Production server and the Test server?
    I'm thinking normally traffic between the two would be blocked.

    to answer your second question

    INSERT INTO TDataseg (partitionkey,catkey,periodkey,DATAVIEW,CALCACCTTYPE,amount,account,ENTITYX    )
    SELECT '123'
        ,catkey
        ,periodkey
        ,DATAVIEW
        ,CALCACCTTYPE
        ,amount
        ,account
        ,ENTITYX
    FROM TDATASEG
    WHERE partitionkey = '118'
        AND YEAR(periodkey) = '2018'

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply