comparing and deleting records wrt a flat file | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

comparing and deleting records wrt a flat file

I have a txr file consit of some records (approx 1000).There is a table in my database which consist of these records along wih some out dated records.What I need is that to compare the text file with table and finally delete the records from the table which does ont exist in the text file.All these steps need to be automated.I am wondering how to accomplish this

One option is export the file data to table and write a query based on the two tables
Madhivanan Failing to plan is Planning to fail
Absolutely and you can schedule this using a DTS package without any problem. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Can you help me with the query or script by which I can compare the data between 2 tables and delete all unmatched records.
I need to compare only single field.

http://www.sql-server-performance.com/vg_database_comparison_sp.asp HTH Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
I stored different records in 2 tables and tried comparing these data ,but it have give the resultant data of second table which is not in first table
I need to compare data of col1 in tbl1 with data of col3 in tbl2 and list the difference in text file.
]]>