Search code examples
t-sqlssissql-delete

What is the syntax for performing a parameterised delete using joins in SSIS 2008?


I'm trying to use an OLE DB Command to perform a delete using data from each row of my input file. The actual query works fine when running manually in sql server (given tableB.otherID is compared to an int), but I'm having issues parameterising it.

delete tableA from tableA
where tableA.ID = ?

The above query runs, and allows me to assign one of my input columns to tableA.ID. This is what I would expect.

Trying

delete tableA from tableA 
INNER JOIN tableB ON tableB.ID = tableA.ID
where tableB.OtherID = ?

Throws up an error however ("The multi-part identifier tableB.OtherID could not be bound"). Hardcoding a value in place of the '?' stops this error from appearing.

It seems like this would be the correct syntax, is there anything wrong with the above?


Solution

  • This seems to be a bug/limitation with SSIS, I've found myself unable to perform similar parameterised update statements using a join.

    Solution I ended up using was creating a temporary stored procedure with the delete statement I wanted, and passing the parameter to it directly.