Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

how to copy a table from db A to db B?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Albert - 08 Jul 2008 17:41 GMT
Hello,

is there a way to copy a table from database A to database B?
I use sql server 2005 express and Management Studio.
Thanks
Albert
Plamen Ratchev - 08 Jul 2008 18:07 GMT
If you have the table structure already created in the target database, you
can use 3 part notation to reference the tables:

INSERT INTO DatabaseB..Table (<columns>)
SELECT <columns> FROM DatabaseA..Table;

Note this assumes default schema for the user. If you have specific schema
names you should reference it:

INSERT INTO DatabaseB.schema_name.Table (<columns>)
SELECT <columns> FROM DatabaseA.schema_name.Table;

You can use SELECT INTO if the target table does not exist, but that will
not copy any constraints or indexes. Best is to script the table and create
in advance, then insert the data.

HTH,

Plamen Ratchev
http://www.SQLStudio.com
Albert - 08 Jul 2008 20:40 GMT
Thanks

> If you have the table structure already created in the target database,
> you can use 3 part notation to reference the tables:
[quoted text clipped - 16 lines]
> Plamen Ratchev
> http://www.SQLStudio.com
Linchi Shea - 08 Jul 2008 18:12 GMT
You can use the Import/Export wizard from Management Studio. Right click on a
database -> Tasks -> Import Data ..., and follow the GUI.

Linchi

> Hello,
>
> is there a way to copy a table from database A to database B?
> I use sql server 2005 express and Management Studio.
> Thanks
> Albert
Albert - 08 Jul 2008 20:41 GMT
Thanks, but unfortunately, there is no import/export wizard in Management
Studio express ....

> You can use the Import/Export wizard from Management Studio. Right click
> on a
[quoted text clipped - 8 lines]
>> Thanks
>> Albert
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.