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.
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
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
[AdventureWorks2012] database and both database are in same server.
CREATE TABLE [NewDataBase].[dbo].EmployeeSales ( BusinessEntityID varchar(11) NOT NULL, SalesYTD money NOT NULL ); GO INSERT INTO [NewDataBase].[dbo].EmployeeSales SELECT BusinessEntityID, SalesYTD FROM [AdventureWorks2012].Sales.SalesPerson; GO