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 Administration
 Data transfer from one table to other

Author  Topic 

nitinnjp
Starting Member

6 Posts

Posted - 2012-03-07 : 07:00:20
I have table A and Table B with same structure(column).I need to transefer data from table A to table B.
Conditions.
1.If record from table A which is not present in table B that need to be inserted.
2.If record from table A which is present on table B.Then check the record is same then we do not need to do something just leave it.If record is mismatch then table B need to be updated.
3.we do not have delete premission.
4.We do not want to use cursor becoz lot or records are present it will cause the performance issue while comparing table.

So please provide me best solution waiting for reply.

nitin patil

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-03-07 : 07:07:02
If you are on SQL 2008 or higher, MERGE command may be the simplest option. http://msdn.microsoft.com/en-us/library/bb510625(v=sql.100).aspx
Go to Top of Page

nitinnjp
Starting Member

6 Posts

Posted - 2012-03-07 : 07:37:33
Thanks Sunita!! I will check is this solution is feasiable for me...:-)

nitin patil
Go to Top of Page
   

- Advertisement -