I want to insert a whole table's contents to another database which has the same table name.

How can I achieve this?

I am using SQL Server Express 2008 R2.


you can create a table with same schema in another database first and copy the data like this. Let say my new Database name is NewDataBase and I want to copy data from table Sales.SalesPerson of [AdventureWorks2012] database and both database are in same server.

CREATE TABLE [NewDataBase].[dbo].EmployeeSales
( BusinessEntityID   varchar(11) NOT NULL,
  SalesYTD money NOT NULL

INSERT INTO [NewDataBase].[dbo].EmployeeSales
    SELECT BusinessEntityID, SalesYTD 
    FROM [AdventureWorks2012].Sales.SalesPerson;

You could also use the Data Import/Export Wizard.

Not the answer you're looking for? Browse other questions tagged or ask your own question.