Skip to content

Instantly share code, notes, and snippets.

@marcoandre1
Last active August 13, 2019 12:15
Show Gist options
  • Save marcoandre1/81133d9cf94d469ddd5077b68667ab2b to your computer and use it in GitHub Desktop.
Save marcoandre1/81133d9cf94d469ddd5077b68667ab2b to your computer and use it in GitHub Desktop.
How to copy a table from a database to another database.

From StackOverflow

Just to show yet another option (for SQL Server 2008 and above):

  1. right-click on Database -> select Tasks -> select Generate Scripts
  2. Select specific database objects you want to copy. Let's say one or more tables. Click Next
  3. Click Advanced and scroll down to Types of Data to script and choose Schema and Data. Click OK
  4. Choose where to save generated script and proceed by clicking Next

This generates a sql file that contains all the entries of the table. Depending on the size of the table, the file can be big! You only need to run the generated script to build the table again in another database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment