Copy SQL Table from 1 database to another

I added another database to my SQL 2005 server and need to copy some table from the old database, what is the easiest method to do so.   By the way, I use MS SQL Server management Studio to manage the tavles, views etc.
LVL 1
MarketingDriveAsked:
Who is Participating?
 
TruzenzexCommented:
Easiest method would be to use the Import Data function, this will allow you to copy tables, views etc...
0
 
RiteshShahCommented:
yes, you can export and import wizard but if you wish to do it by T-SQL than here is the command.


select * into db2..table1 from db1..table1 where db1..table1.id>50
0
 
RiteshShahCommented:
or

insert into db2..table1
select * from db1..table1 where db1..table1.id>50
0
 
reb73Commented:
Right-Click on the source database in SQL Management Studio and choose 'Tasks' and then Export Data. This will bring up a wizard that will guide you..
0
 
FatEric13Commented:
Hi MarketingDrive,

I did the following to copy an existing table in our production db to our test db (on the same sql server, but in different databases):

In your Microsoft SQL server Management Studio, open a 'new query' window.

Past following in the window and edit the names between [ ]
USE [targetDBname];SELECT * INTO [targetTable] FROM [sourceDB].dbo.[sourceTable]

Hope this helps you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.