Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Copying the records to a same table structure.

Author  Topic 

anabelle
Starting Member

19 Posts

Posted - 2010-07-28 : 23:28:22
Production1 and Production2 database is of the same structure,both contains dbo.sales table. Production1 database contains new records of dbo.sales to be transferred to Production2 database into dbo.sales table.

How am i going to insert those records from Production1.dbo.sales to Production2.dbo.sales?

edit: moved to proper forum

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-07-28 : 23:30:47
INSERT INTO Production2.dbo.sales
SELECT * FROM Production1.dbo.sales
Go to Top of Page

anabelle
Starting Member

19 Posts

Posted - 2010-07-28 : 23:42:08
Msg 273, Level 16, State 1, Line 3
Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column.

THIS IS THE ERROR MESSAGE when i try to run the script,because in the table dbo.sales it has loggeddate and loggedtime...how am i going to exclude the timestamp?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-29 : 04:46:25
INSERT INTO Production2.dbo.sales(col1,col2...colN)
SELECT col1,col2...colN FROM Production1.dbo.sales

Exclude timestamp column from the list

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -