If an error occurs when you are in BIDS, then the ajdams solution will not work, since it only applies to errors that occur when starting a package from SQL Server Agent.
The main problem is that SSIS is trying to resolve metadata. From the point of view of the table ## do not exist, because they can not return metadata for the object during the pre-execution phase. Therefore, you must find a way to satisfy your requirement that the table already exists. There are several solutions:
Do not use temporary tables. Instead, create a working database and put all your objects in it. Obviously, this probably will not work if you are trying to get data on a server where you are not a dbo, as a production server, so you cannot rely on this solution.
Use CTE instead of temporary tables. This works if your source server is 2005/2008. This will not help if the source server is 2000.
Create table ## in a separate Execute SQL command. Set the RetainSameConnection property of the connection to True. Set the DelayValidation parameter to true for the data stream. When you tune the data stream, fake it by temporarily adding the SELECT TOP 0 = CAST (NULL AS INT) field to the beginning of the stored procedure, which has identical metadata for your final output. Remember to remove this from the stored procedure before running the package. It is also a convenient way to exchange temporary tabular data between data streams. If you want the rest of the package to use separate connections so that they can work in parallel, you need to create an additional non-shared connection. This avoids the problem because a temporary table already exists during data flow tasks.
Option 3 achieves your goal, but it is complicated and has the limitation that you need to separate the create ## command in another call to the stored procedure. If you have the ability to create stored procedures on the source server, you probably also have the ability to create other objects, such as staging tables, and this is usually the best solution. These are also side steps associated with TempDB problems, which are also a desirable benefit.
Good luck and let me know if you need further guidance on how to implement step 3.
Registered User
source share