How to Copy complete structure of a table with data from one database table to another databse table

I need a sql query to copy structure of table with data from production table of ONLINEBTREKDB database to production table of Archive database.
I tried this query
select * into Archive.dbo.Production from ONLINEBTREKDB.dbo.Production p
but problem is I am able to copy the table schema and data but not able to copy constraints(PK)
Any Help?
seema

You've multiple options
1. Use generate scripts wizard available in SQL management studio. This is particularly helpful when you want to script out lot of objects. You can also choose to script data as well inside this. This can be launched by right clicking the db, choosing tasks
-> generate scripts and then selecting required options inside the wizard
2. Use object explorer and right click and script out table. You can also use search functionality to find object you want inside object explorer
http://visakhm.blogspot.in/2013/02/object-filtering-using-ssms-object.html
3. Use query based on INFORMATION_SCHEMA views like TABLES,COLUMNS,CONSTRAINT_COLUMN_USAGE etc to generate the script
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Copy few test assignment with User from one database instance to another

    Hi,
    I have OTL ,Payroll and HRMS system. I want to Copy few test assignment with User(Few FND Users) from one database instance to another .
    Source: DEV Instance
    OTL users to enter their Time sheet
    OTL is intergated with HRMS to pickup Employee information
    Existing business users are integrated with Employee assignment etc tables to pickup person_id
    Target: Want to copy few test OTL users from ONE instance to another. Bringing FND_User is easy but EMPLOYEE_ID, PERSON_PART_ID will not come during FNDLOADER .
    How to bring all information from one instance to another instance? Please advice.
    thanks .

    Dear,
       Try using HRMS configuration workbench. For this you might require support from your DBA for configuring the same. Once configured, you can move the items you want.
    Regards,
    Kathan

  • How to move tables with data from one client to another

    Hello friends
    I have 2 clients 001 and 002.
    I have created a table with lots of data on client 001.
    I have to get the same table on 002 also with the same data.
    Is there an easier way of transfering this data from one table to another?
    I would appreciate any feedback on this.
    I know that mappings etc., can be done using the export and import of tpz file. So I want to know if there is any similar thing to transfer a table with data.
    THanks
    Ram

    hi
    thanks for the response
    We are working on a sandbox system for demo purpose.
    Actually we have two different group of people using two different clients created on the same server.
    Our group is using client 001 and another group is using client 002.
    We don't want the changes that one group does to the table to affect the other.
    Our group has created a z-table and have entered considerable amount of data.
    However, the other group also need to create the same table with the same data.
    So to avoid double work, we were trying to see if there is a way to copy the table with data created on 001 to 002.
    Any suggestions / feedback will be greatly appreciated.
    Thanks
    Ram

  • Moving tables with data from one client to another

    Hello friends
    I have 2 clients 001 and 002.
    I have created a table with lots of data on client 001.
    I have to get the same table on 002 also with the same data.
    Is there an easier way of transfering this data from one table to another?
    I would appreciate any feedback on this.
    I know that mappings etc., can be done using the export and import of tpz file. So I want to know if there is any similar thing to transfer a table with data.
    THanks
    Ram

    If you do not have the client field in your table, then the table is cross-client.
    IF you have the client field filled with 001, then you need to create the same entries with client 002, I dont think that you can do this with a transport.
    You have to write an ABAP that reads and writes the data.

  • How export one table along with data from one location to other location

    Hi All,
    I'm new in export/import practice.
    Can anyone plz tell the steps along with commands to do the following:
    1. I want to export a table with data from one location(computer) to other(computer) that are in same network.
    2.Also from one user to another user.
    I'm using oracle 10g.
    regards
    Sonia
    Edited by: 983040 on Feb 19, 2013 11:35 PM

    First of all read documentation
    Oracle Export/Import : http://docs.oracle.com/cd/B19306_01/server.102/b14215/exp_imp.htm
    Datapump Export/Import : http://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_overview.htm
    If you are using Datapump or Traditional Export/import you need to follow following steps
    *1) Take User dump via EXPDP on Computer A .*
    For EXP
    exp username/password owner=Test file=D:\test.dmp log=D:\test.log
    For EXPDP
    expdp username/password schemas=TEST directory=TEST_DIR dumpfile=TEST.dmp logfile=TEST.log*2) Copy that to Computer B*
    *3) Import dumpfile.*
    For IMPDP  Use remap_schema optionhttp://www.acehints.com/2012/05/data-pump-impdp-remapschema-parameter.html
    For IMP use fromuser and touser option
    one user to another user imp

  • How to transport/move a table with data from development to Test to Production

    Hi,
    How to transport/move a table with data from development to Test to Production..? Export-Import a Delivery Unit does only the structure and not the data
    Reg
    Sri

    Hi Sri,
    You cannot transport Data via Transport route in HANA, you can only transport code changes/Structure via DU. For Data movement, you either have a do a export/import from a flat file or replication from a Source System to HANA.
    Thanks Much,
    Abhishek

  • How to copy the data from one database to another database without DB link

    Good Day,
    I want to copy the data from one database to another database with out DB link but the structure is same in both.
    Thanks
    Nihar

    You could use SQL*Plus' COPY command
    http://technology.amis.nl/blog/432/little-gold-nugget-sqlplus-copy-command
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/apb.htm#sthref3702
    Edited by: Alex Nuijten on Sep 16, 2009 8:13 AM

  • How do i transfer data from one internal tabe to another.

    Hi All,
             How do i transfer data from one internal tabe to another.
             Can i do it ebven if he tables are different in structure.
    Please Advice.
    Thanks in advance.

    Hi Saket Tiwari,
    I hope the earlier post by kashyap is good enough an answer. anywas in addition to it let me give a detailed
    explanation of how you can populate an internal table.
    1) Append data line by line.
         Syntax :  APPEND [<wa> TO / INITIAL LINE TO] <itab>.
    this appends new line to internal table <itab>.
    2) Using COLLECT statement.
                 COLLECT is another form of statement used for populating the internal tables.  Generally COLLECT is used while inserting lines into an internal table with unique standard key. The syntax for COLLECT statement is as shown
         Syntax : COLLECT [<wa> INTO] <itab>.
    3) Using INSERT statement
         Syntax  INSERT [<wa> INTO / INITIAL LINE INTO] <itab> [index <idx>].
    INSERT statement adds a line/work area to the internal table. You can specify the position at which the new line is to be added by using the INDEX clause with the INSERT statement.
    Now coming to your request..
    To append part or all of an internal table
         Syntax
                  APPEND LINES OF <itab1> [FROM <n1>] [TO <n2>] TO <itab2>.
    *     Note:
    Without the FROM and TO options, this statement appends the entire table <itab1> to <itab2>.*
    b) To insert part or all of an internal table into another internal table
         Syntax
              INSERT LINES OF <itab1> [FROM <n1>] [TO <n2>]
              INTO <itab2> [INDEX <idx>].
    c) Using Move statement.
    To copy entire contents of one table into another in one execution
         Syntax MOVE  <itab1> To <itab2>.
                   OR
              <itab1> = <itab2>.
    but u hav to be careful because he contents of itab2 will eb overwritten on the execution of this statement.
    These copy the contents of ITAB1 to ITAB2. Incase of internal tables with header line we have to use [] inorder to distinguish from work area. So, to copy contents of internal tables with header line  the syntax becomes,
    ITAB1[] = ITAB2[].
    Coming to the letter part of your question, Yes, we can copy values between tables having different structures.
    for this we use    
                                MOVE-CORRESPONDING <itab1> TO <itab2>
        this executes the statement for their header lines. Searches for the sub-fields which occur both in itab1 and itab2 and then generates, for all relevant field pairs which correspond to the
            sub-fields ni , statements of the form MOVE itab1-ni TO itab2-ni. The other fields remain unchanged.
    I hope the information provided has been of your help.
    Reward if useful.
    Regards,
    Jose

  • How to move only subset of data from one database to another?

    Both source & destination are Oracle11g databases.
    The requirement details are as below,
    1) The database contains static as well as transactional data for telecom domain.
    2) We have to move region-wise data from one database to another.
    3) There are around 10 regions.
    4) The region wise data extraction from source db is based on around 40 to 50 tables. Rest of the tables contains
    static data & it will not change.
    5) The volume is around 1 million subscribers per region.
    6) The migration is required because
    a) The client is upgrading its base product which uses this database
    b) There is a change in structure of static tables
    c) Hardware upgrade
    d) The client want to start with single region on new database & rest of the regions will be operated from old
    database.
    7) Keep execution time to very minimum.
    I am thinking to have solution as below,
    1) Create destination database with upgraded db structure (as mentioned in 6b)
    2) Create database links to access source db in destination db.
    3) Write SQL queries to fetch data from all the respective tables for a specific region
    4) Write separate PL/SQL blocks for each table to fetch data from source db & insert into respective table in
    destination db
    a) Use FOR ALL & bulk collect to improve the performance
    b) Divide table data into multiple chunks & execute parallel batches (around 10) to insert the data
    5) Validate pre & post counts to verify the success of migration
    Is there any other better way?
    Regards,
    Sandeep

    How to move only subset of data from a partiular table by using transportable tablespace?
    E.g. SUB table using SMP_SUB tablespace contains subscriber data in source database.
    The indexes defined on SUB table are under SMP_IDX_SUB tablespace
    The subscribers data can be categorized by different regions, say region_id column. Then how to move data & indexes of SUB table from source db to destination db?
    any specific example would be helpful.

  • Table Data From One DataBase to another

    Dear Fellows,
    There are two DataBases running in my NT Server. I want to pull data of a table from other database. Does any body know how can I do it if I dont want to export and then import.
    Thanks in advance
    Danish

    Please find the help for SQL*PLUS command COPY.
    It will be useful when you want to copy datas from one database from another database without using import & export.

  • Concerning midi data in GarageBand for iOS: can we copy midi data from one virtual instrument to another?

    Concerning midi data in GarageBand for iOS: can we copy midi data from one virtual instrument to another?
    For instance: I play my "lucky take" on the virtual piano, and now I am curious how it would sound on let's say a organ. Normally I would select the midi content out of the piano track and copy it into the organ track. I cannot figure out how to do this in GarageBand for iOS. Is there anyone out there with a solution?
    Thanks!

    It is limited, how you can move regions between tracks. Basically, you can move between tracks with the same touch instrument.  See the help: http://help.apple.com/garageband/ipad/2.0/index.html#chsec12c15d
    Move a region
    Drag the region left or right to move it forward or back in time. Align the left edge of the region with the bar or beat on the ruler where you want it to start playing.
    Drag the region up or down to move it to another track with the same Touch Instrument. You can also drag regions between Keyboard and Sampler tracks, and between Audio Recorder and Guitar Amp tracks. Smart Drums regions cannot be dragged to another Smart Drums track.
    If you move a region so that it overlaps another region, the overlapped part of the “covered” region is deleted.
    Paste a region
    You can paste a region you have copied, or paste an audio file from an app that supports copying audio to the clipboard. GarageBand supports 44.1 kHz sample rate, 16-bit depth uncompressed audio files.
    You can paste copied regions to another track with the same Touch Instrument. You can also paste regions between Keyboard and Sampler tracks, and between Audio Recorder and Guitar Amp tracks. Smart Drums regions cannot be pasted to another Smart Drums track. Audio files copied from another app can be pasted to Audio Recorder or Guitar Amp tracks.
    Move the playhead to the point where you want the region to start.
    Tap the header of the track where you want to paste the region to select the track.
    Tap the track where you want to paste the region, then tap Paste.You can also tap an empty area of Tracks view, then tap Paste. In this case the region is pasted into the currently selected track.

  • Copy data from one SAP system to another based on conversion rules

    Hi All,
    Please provide your input on how can we copy data from one SAP system to another based on conversion rules.
    Conversion rule :
    vkrog in 110  vkorrg in 120
    1234            4567   
    <<text removed>>
    Thanks
    Edited by: Matt on Feb 16, 2009 4:35 PM

    Please read the Rules of Engagement here: Please read "The Forum Rules of Engagement" before posting!  HOT NEWS!!
    Please note that offering points is against the rules.
    matt

  • How to pass data from one internal session to another internal session

    hi all sap experts ,
    How to pass data from one internal session to another internal session and from oneExternal session to another external session.
    Except : Import and Export parameters and SPA/GPA parameters.
    Tell me the otherWay to pass data ..
    Plz
    Thanks in advance

    hi,
      abap memory management u will understand about this concept.
    the import /export parameter will help u that passing data between two internal sessions by using abap memory.
      for syntax
    Passing Data Between Programs
    There are two ways of passing data to a called program:
    Passing Data Using Internal Memory Areas
    There are two cross-program memory areas to which ABAP programs have access (refer to the diagram in Memory Structures of an ABAP Program) that you can use to pass data between programs.
    SAP Memory
    SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens (see below).
    ABAP Memory
    ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse. For further information, refer to Data Clusters in ABAP Memory.
    Filling Input Fields on an Initial Screen
    Most programs that you call from other programs have their own initial screen that the user must fill with values. For an executable program, this is normally the selection screen. The SUBMIT statement has a series of additions that you can use to fill the input fields of the called program:
    Filling the Selection Screen of a Called Program
    You cannot fill the input fields of a screen using additions in the calling statement. Instead, you can use SPA/GPA parameters. For further information, refer to Filling an Initial Screen Using SPA/GPA Parameters.
    Message was edited by:
            sunil kumar
    Message was edited by:
            sunil kumar

  • How to pass data from one internal session to another

    Hi SAP Experts,
    How to pass data from one internal session to another and from One external session to another external session. I used import and export parmeter and SPA/GPA parameters. What is the other way to pass data?
    Please tel me urgently
    Thank you
    Basu

    Memory Structures of an ABAP Program
    In the Overview of the R/3 Basis System you have seen that each user can open up to six R/3 windows in a single SAPgui session. Each of these windows corresponds to a session on the application server with its own area of shared memory.
    The first application program that you start in a session opens an internal session within the main session. The internal session has a memory area that contains the ABAP program and its associated data. When the program calls external routines (methods, subroutines or function modules) their main program and working data are also loaded into the memory area of the internal session.
    Only one internal session is ever active. If the active application program calls a further application program, the system opens another internal session. Here, there are two possible cases: If the second program does not return control to the calling program when it has finished running, the called program replaces the calling program in the internal session. The contents of the memory of the calling program are deleted. If the second program does return control to the calling program when it has finished running, the session of the called program is not deleted. Instead, it becomes inactive, and its memory contents are placed on a stack.
    The memory area of each session contains an area called ABAP memory. ABAP memory is available to all internal sessions. ABAP programs can use the EXPORT and IMPORT statements to access it. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.
    All ABAP programs can also access the SAP memory. This is a memory area to which all sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters are often used to preassign values to input fields. You can set them individually for users, or globally according to the flow of an application program. SAP memory is the only connection between the different sessions within a SAPgui.
    The following diagram shows how an application program accesses the different areas within shared memory:
    In the diagram, an ABAP program is active in the second internal session of the first main session. It can access the memory of its own internal session, ABAP memory and SAP memory. The program in the first internal session has called the program which is currently active, and its own data is currently inactive on the stack. If the program currently active calls another program but will itself carry on once that program has finished running, the new program will be activated in a third internal session.
    Data Clusters in ABAP Memory
    You can store data clusters in ABAP memory. ABAP memory is a memory area within the internal session (roll area) of an ABAP program and any other program called from it using CALL TRANSACTION or SUBMIT.
    ABAP memory is independent of the ABAP program or program module from which it was generated. In other words, an object saved in ABAP memory can be read from any other ABAP program in the same call chain. ABAP memory is not the same as the cross-transaction global SAP memory. For further information, refer to Passing Data Between Programs.
    This allows you to pass data from one module to another over several levels of the program hierarchy. For example, you can pass data
    From an executable program (report) to another executable program called using SUBMIT.
    From a transaction to an executable program (report).
    Between dialog modules.
    From a program to a function module.
    and so on.
    The contents of the memory are released when you leave the transaction.
    To save data objects in ABAP memory, use the statement EXPORT TO MEMORY.
    Saving Data Objects in Memory
    To read data objects from memory, use the statement IMPORT FROM MEMORY.
    Reading Data Objects from Memory
    To delete data clusters from memory, use the statement FREE MEMORY.
    Deleting Data Clusters from Memory
    please read this which provide more idea about memory
    Message was edited by:
            sunil kumar

  • Transfer a table with data from 1 client to another client

    Hi experts please focus on this issue.  what is table maintainance generator? what is the main advantages of it.
    how can we transfer a table with data from 1 client to another client.
    Thanks  in advance
    vamsi.

    Table maintenance generator can be generated via se11 on your table.
    The advantage is that the table can manaully be updated via SM30.
    If you want to transport to another client the table content, I think you can :
    - Generate a transport request in SM30 ( Transport button)
    - use SCC1 to transport from a client to another.
    Regards,
    Erwan

Maybe you are looking for

  • How to permanent delete Network,Activity,WBS through BAPI ?

    Hi, I am using BAPI_PROJECT_MAINTAIN for creating Network,WBS and Activities. I am successfully able to create the above things. However when I delete using the above BAPI, they are not deleted physically from UI. They remain visible on SAP GUI with

  • Itunes won't open after redownloading it.

    Everytime I try to open my itunes I keep getting the error message "The file itunes library cannot be read because it was created by a newer version of itunes". I have tried deleting itunes and redownloading it but itunes will not open no matter what

  • Bill to address details for PO form

    Hi, Can u get the table name and field name (name,other name,house number,street,city,postal code,country,country,tel1_number,extension) for fetching the details of BILL TO ADDRESS for PURCHASE order form

  • Link Combo box(drop down) to Column chart

    Hello Gurus, I am new to this Xcelsius world...  I have 3 excel books with three different weeks data, i would like to create drop down for thr three week and link to the column bar chart with filter. could you please help me any one. thanks in adava

  • Nullpointerexception when using servlet with Mysql on a cobalt Raq3 Server

    I'm a student and i have to use servlets and Mysql to make a Database application. Our school has a Cobalt Raq3 server and has installed Java Dev Kit 1.3a. First problem they can't tell me their driver manager for Mysql. Second problem when i try my