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
 General SQL Server Forums
 New to SQL Server Programming
 Appending data to new a DB

Author  Topic 

Shrews14
Starting Member

37 Posts

Posted - 2007-02-02 : 04:20:36
Hi i'm trying to append data from one table to another both with exactly the same table structure, using a SProc. The code i have used is

CREATE PROC sp_append_DB1_to_DB2

AS

INSERT INTO DB2.dbo.datatable1
SELECT *
FROM DB1.dbo.datatable1;

GO

i run this and get an error message-

Server: Msg 547, Level 16, State 1, Procedure sp_append_DB1_to_DB2, Line 5

It appears i'm having a problem copying into a foriegn key field, how do i get around this?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-02-02 : 04:27:00
Which field in the datatable1 is having foreign key on it? with which table?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -