please Can anyone send me the script to Copy Data from one server to another server

  • please ...................

    Can anyone send me the script to Copy Data from one server to another server .

    Thanks a lot

  • Are you moving a specific table, or a whole database, or part of a table, or multiple tables? Will you be doing this once, or repeatedly? Are you trying to synchronize two databases?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Scripts like that are usually pretty specific to the database being copied. You might want to look at the Copy Database wizard for what you are trying to accomplish.

  • Hi,

    The first thing that comes to mind is that you are asking someone to do your work for you.

    The second thing that comes to mind is that the fastest way might to be use a backup and delete the objects you don't want. ++

    Assuming that you just want the tables and views, I would start experimenting with the system views and some dynamic SQL. For example, the dynamic SQL would allow to scroll through sys.sysobjects to get you all of the tables and views [sys.sysobjects.type in ('U', 'V')]. This would allow you to use the SELECT INTO statement and transfer the data (or at least the table structure) across. Then there are the others DB-objects that you'd like to have: keys, constraints, indexes and so on.

    If you are going across servers, you'll have to create a linked server, unless you restore a backup on the target server.

    As an exercise, it's a great way to get to learn the various system views and how the DB-Objects are stored and interact. It's also a great way to put dynamic SQL to use. Finally, when you have written this wonderful script, you can post it up here for people like yourself as well as the rest of us.

    I hope that helps. Learning by doing is a great way to learn. You just need enthusiasm and time.

  • I recommend you check out how to use the import export tools in SSMS. You can also look at learning SSIS to perform the same task or you could purchase RedGate Data Compare.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • The best and simple form to copy your data to another server would be to Backup the database and Restore it on the new server. Now if this process needs to run daily then I would Link the servers and create a SSIS package to drop the table and recreate the tables with the new data. Their are many way to accomplish this task.

  • For Complete data of the Database on server1 to Server2:

    U should take the backup & Retore

    For Some tables only:

    Right click on the Server2 database & Select import data. Go through wizard.

  • MS Publishing wizard can be used for generating Insert scripts as per tables and also for whole database.

Viewing 8 posts - 1 through 7 (of 7 total)

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