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 2000 Forums
 SQL Server Administration (2000)
 exporintg data from table to table

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-02-15 : 03:32:27
i am trying to export data from one table to another
the problem is like this :
source table :
person_id
comments
createdate

destiny table
id (identity)
person_id
comments
createdate

the problem is with the id column on the destiny - i recive an error that i try to insert a null an i violate the key or something like that
how can over come this problem?
i event went to the code and tried to somehow workaround and to do
DTSDestintaion=1
but i got error of duplicate key
what to do>?
thanks in advance
peleg

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)

Kristen
Test

22859 Posts

Posted - 2006-02-15 : 03:40:24
Maybe this?

INSERT INTO [destiny table]
(
person_id, comments, createdate
)
SELECT person_id, comments, createdate
FROM [source table]

Kristen
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-15 : 03:41:00
is the source table and destiny table on the same server ?
If so, why not just
insert into db2.dbo.destiny(...)
select ...
from db1.dbo.source


----------------------------------
'KH'

everything that has a beginning has an end
Go to Top of Page

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-02-15 : 06:24:23
ow ok i tried to do it with th e sql server tools not code
thnaks anyway:)

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
Go to Top of Page
   

- Advertisement -