You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@hop.apache.org by Rob Burgess <ba...@hotmail.com> on 2025/03/20 17:25:13 UTC

Delete data from table based on comparing two variables

Hi

I would like to delete data from a SQL Server table in a pipeline based on comparing two variables.

Is the 'filter rows' step suitable for comparing the two variables (varA = varB) or is there a better way?

Thanks

Rob



Re: Delete data from table based on comparing two variables

Posted by Davide Cisco <da...@unipd.it>.
By "variable" do you mean "Hop variable", or just two database fields? In
both cases you could use Filter rows but there are better approaches in my
opinion:

   - to compare two Hop variables, you would probably better wrap your
   project in a workflow, and use a Simple evaluation action to compare the
   two variables. Then setup the pipeline that executes the deletion, and link
   its Pipeline action via the TRUE result of the previous Simple
   evaluation (assuming you want to delete data if the condition is met)
   - if they are two database fields, Filter rows is the way if you
   previously processed the data extracted from the database: just specify the
   left (first) and the right (second) field names to compare in the "field"
   area. But if you didn't need data processing before, why not use directly a
   query like "DELETE FROM table WHERE varA = varB" via an Execute SQL script
   transform?

Hope this helps :)


Il giorno gio 20 mar 2025 alle ore 18:25 Rob Burgess <ba...@hotmail.com>
ha scritto:

> Hi
>
> I would like to delete data from a SQL Server table in a pipeline based on
> comparing two variables.
>
> Is the 'filter rows' step suitable for comparing the two variables (varA =
> varB) or is there a better way?
>
> Thanks
>
> *Rob*
>
>
>