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 |
thakur_amit
Starting Member
6 Posts |
Posted - 2010-02-25 : 12:49:46
|
Hi,I want to delete recodrs from based on some join condition between two tables.One table belongs to my DB ( table name : FeeDetails)and second table ( TargetTable) is on different server.I have delete records from TargetTable table based on join condition between two tables.I am able to select recordsselect * fromOPENDATASOURCE ('SQLOLEDB','Data Source=BHUPENDRA;user id=sa;password=password') .DBName.dbo.targetTable awhere exists(select * from FeeDetails bwhere a.SFH_ID=b.SFH_IDand a.SchoolId=b.SchoolId anda.SPD_NAME=b.SPD_NAMEand b.TransferFlag='M')SELECT * FROM OPENDATASOURCE('SQLOLEDB','Data Source=BHUPENDRA;user id=sa;password=password') .DBName.dbo.targetTable aWHERE EXISTS (SELECT *FROM FeeDetails bWHERE b.TransferFlag='M'and a.SFH_ID=b.SFH_IDand a.SchoolId=b.SchoolIdand a.SPD_NAME=b.SPD_NAME)------But when i am trying to delete records from target table...i am getting error...my delete queriesdelete from OPENDATASOURCE ('SQLOLEDB','Data Source=BHUPENDRA;user id=sa;password=password') .DBName.dbo.fee_ aWHERE EXISTS (SELECT *FROM fee_ bWHERE b.TransferFlag='M'and a.SFH_ID=b.SFH_IDand a.SchoolId=b.SchoolIdand a.SPD_NAME=b.SPD_NAME)delete fromOPENDATASOURCE ('SQLOLEDB','Data Source=BHUPENDRA;user id=sa;password=password') .DBName.dbo.fee_ awhere exists(select * from fee_ bwhere a.SFH_ID=b.SFH_IDand a.SchoolId=b.SchoolId anda.SPD_NAME=b.SPD_NAMEand b.TransferFlag='M')Please help me out..to fix this ... |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-26 : 08:19:27
|
whats the error you're getting?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|