tags:

views:

126

answers:

4

How to pull data from one database to another database by using sqlsqerver 2005

like ..Exporting data from one and importing to the another.

+2  A: 

Take your pick.

  1. Linked Server/databases.
  2. SSIS
  3. Exporting data from one and importing to the another.
no_one
Exporting data from one and importing to the another.
+2  A: 

In addition to no-one's answers, if the DB's are both SQL Server

4) Select * into New_Table From Server.Database.Owner.Table

MrTelly
This is no_one's answer number 1
ck
A little example goes a long way though, and vec doesn't state whether he's moving between servers.
MrTelly
+1 for giving a nice clean example
marc_s
+1  A: 

Based on your comments I understand that both databases are on the same server You can simply do:

use YourDestinationDatabaseName;

select * into dbo.yourNewTable from YourSourceDatabase.dbo.YourSourceTable

and if you want to insert into table that already exists

use YourDestinationDatabaseName;

insert into dbo.YourDestinationTable 
select * from YourSourceDatabase.dbo.YourSourceTable

or more precisely:

use YourDestinationDatabaseName;

insert into dbo.YourDestinationTable( col1, col2, etc...) 
select 
    col1a, col2a, etc ... 
from 
    YourSourceDatabase.dbo.YourSourceTable
kristof
A: 

If you have VS 2005, I like this tool, because it generates t-sql: http://www.microsoft.com/downloads/details.aspx?FamilyId=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en