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.
| Author |
Topic |
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-25 : 03:06:11
|
| I have an issue I want to pump data from table1 of database1(server1) to table1 of database1(server2).But every time i transfer data it should check whether the same record exist or not.If exist then it should not insert.How can I do yhis..eg:--transferring emp_details like emp_id,emp_name,emp_age,emp_address.So when I do transfer to the table1 of server2 I should check if available then don't insert otherwise insert.... |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-10-25 : 04:08:16
|
this will give you an idea...insert into server2.emp_details (...)select ...from server1.emp_details t1left join server2.emp_details t2 on t1.emp_id = t2.emp_idwhere t2.emp_id is nullcorrect the syntax on table names...Go with the flow & have fun! Else fight the flow |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-10-25 : 04:12:46
|
| insert into tbl2select t1.<fields> from tbl1 t1join tbl2 t2 on t1.id!=t2.idinstead of the entire table, pose a query instead, if you're using import/export, choose table2 as destination instead of allowing sql to create new table 'result'.just an idea...--------------------keeping it simple... |
 |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-25 : 05:32:16
|
| I think the way I explained wasn't correct..Lets say i select a server A and Server B.Now I have a connection between them.Now in the source I will have a query of "Select emp_id,emp_name,emp_age,emp_addressFrom Emp_details".Now in the destination I have a table with the same structure with additional one or two columns.Now I will have a mapping between the source and destination in the transformation and then when I execute it will insert records into the the table of the serverB table.but if I have already have an emp_id in the srever b table then i don't want to insert into it... |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-10-25 : 08:09:17
|
so isn't that what we suggested??or do you mean that the table on server B must be completly empty?Go with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|