|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL in DTS Package
The SQL that I want to execute for one step in my package
is as follows: DELETE FROM DB1.dbo.Table1 WHERE load_id IN (SELECT load_id FROM DB2.dbo.Table2 WHERE (month_id = ?); ? = a value from a global variable. When I try to do this in a straight forward manner using an "Execute SQL" task, I get an error saying that you can't have a parameter in a sub query. If I try to do it creating a temptable with the following code it gives me an error because (I think)the temp table doesn't exist yet. Create Table #dummy (load_id INT); INSERT INTO #dummy SELECT load_id FROM DB2.dbo.Table2 WHERE (month_id = ?); DELETE FROM DB1.dbo.Table1 WHERE load_id in (select load_id from #dummy); The only way that I can get this to work is using the Data Driven Query Task which seems like overkill for this application. Any ideas on how to do this directly in the "Execute SQL" task? |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > SQL in DTS Package |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|