Copy table

  • Hi experts,

    How to copy a table from one database to another in the same server.

    TIA

  • Done using select * into...Can anyone please tell how to delete a post???I tried to delete but no use :hehe:

  • There are drawbacks to using Select Into...

    For a more general stored procedure for copying a list of tables, procedures or functions from one database to another have a look at this procedure I wrote a while back..

    http://www.simple-talk.com/code/MoreDMO/spDBTransfer.txt

    Which is part of an article I wrote a while back that I'm quite proud of

    Automating Common SQL Server Tasks using DMO[/url].

    You'll need to Download DMO from the Feature Pack for Microsoft SQL Server 2005. Don't worry, it still works in SQL Server 2008.

    Best wishes,
    Phil Factor

  • Hi

    The best method to copy objects (with/without data) from one database to another I think is Import/Export method.

    Thnx

    Vaseem

  • The select into wont carry over the Keys/Indexes.. even you have to redo the IDENTITY Field.

    IMPORT/EXPORT is the best method for a Quick Table Move.

  • select * into [ Dist database name].[dbo].

    from [Source Database name].[dbo].

    /*

    This is possiable only when the user have the Write on [Dist] and Read permission on [Source]

    */

    This will helps you!!

Viewing 6 posts - 1 through 5 (of 5 total)

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