I have a table with the table name, column name, column values and whether the column values should be included or excluded.
This table is used to filter what data should be loaded. Here is an example
TableName ColumnName ColumnValue Include/Exclude
tblProduct ProductID 1 Exclude
tblProduct ProductID 2 Exclude
tblProduct ProductName Keyboard Include
tblProduct ProductName Mouse Include
tblOrder OrderID 1 Exclude
tblOrder OrderID 2 Exclude
tblOrder OrderName PackageA Exclude
tblOrder OrderName PackageB Exclude
So the queries should be:
DELETE FROM tblProduct WHERE ProductID NOT IN (1,2) AND ProductName IN ('Keyboad','Mouse')
DELETE FROM tblOrder WHERE Order NOT IN (1,2) AND OrderName NOT IN ('PackageA',''PackageB')
Do I have to use a cursor to loop thru each of the column name and filter on the column values?
This table is used to filter what data should be loaded. Here is an example
TableName ColumnName ColumnValue Include/Exclude
tblProduct ProductID 1 Exclude
tblProduct ProductID 2 Exclude
tblProduct ProductName Keyboard Include
tblProduct ProductName Mouse Include
tblOrder OrderID 1 Exclude
tblOrder OrderID 2 Exclude
tblOrder OrderName PackageA Exclude
tblOrder OrderName PackageB Exclude
So the queries should be:
DELETE FROM tblProduct WHERE ProductID NOT IN (1,2) AND ProductName IN ('Keyboad','Mouse')
DELETE FROM tblOrder WHERE Order NOT IN (1,2) AND OrderName NOT IN ('PackageA',''PackageB')
Do I have to use a cursor to loop thru each of the column name and filter on the column values?