Skip to content

Copying from one SQL table to another SQL table in external database

May 21, 2012

Here’s a very simple and sometimes effective way if you are doing testing to copy from a whole data of an SQL table to another SQL table of the same name in another database.

SELECT *
INTO new_table_name [IN externaldatabase]
FROM old_tablename

I say its ideal for testing, because be sure to check that this SQL statement will not gneerate the next index for the Primay Key as according to the old table, and default values may not be restored.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: