Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

delete rows when matching data

Posted on 2011-02-28
2
Medium Priority
?
318 Views
Last Modified: 2012-05-11
Hi Experts

I populate a sql server 2008 DB table from SAP using a web service in C#.net 2010 and when that tables gets populated i want to be able to see if another table has a certain field(PART NUMBER) that matches the populated table from SAP and if matches then remove row from populated SAP table?

Thanks
0
Comment
Question by:razza_b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Accepted Solution

by:
Sharath earned 2000 total points
ID: 35004282
try any of these. Make sure that you have the backup of this table before running the DELETE command in case if you want to retain the data.
DELETE FROM AnotherTable 
      WHERE Part_Number IN (SELECT Part_Number 
                              FROM SAP_Table);

Open in new window

DELETE FROM AnotherTable 
      WHERE EXISTS (SELECT 1 
                      FROM SAP_Table 
                     WHERE AnotherTable.Part_Number = SAP_Table.Part_Number);

Open in new window

0
 
LVL 1

Author Comment

by:razza_b
ID: 35004407
Thanks, will try this once i get a chance will let you know.

cheers!!
0

Featured Post

Create CentOS 7 Newton Packstack Running Keystone

A bug was filed against RDO for the installation of Keystone v3. This guide is designed to walk you through the configuration for using Keystone v3 with Packstack. You will accomplish this using various repos and the Answers file.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question