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
 Sync Procedure

Author  Topic 

parikhm3
Starting Member

12 Posts

Posted - 2007-07-23 : 16:02:44
how do i write a sync procedure that syncs both tables and ensures that Table_2 keeps all services that are listed in Table_1

how do i write a procedure for the sync between both tables, and put this procedure into the package

so basically there have to be two sync parts: First is INSERT of what is not yet existing, second one is UPDATE on the appropriate attributes.

How would i write this sync procedure?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-23 : 16:03:55
if exists (desired resultset)
begin
...update
end
else
begin
...insert
end

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-07-23 : 17:08:38
I'd do this

http://weblogs.sqlteam.com/brettk/archive/2004/04/23/1281.aspx

Or you might consider a trigger for INSERT, UPDATE, DELETE



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -