Let me start at the beginning. I need to produce a result set that allows for bi-directional recursion, in other words the result set in total is based upon a recursive query and a column in the result set also is built by the recursion. Ultimately, this SQL will become a data source in SSIS, but this is not a SSIS question. All of this is due to converting as single PL SQL statement that uses sys_connect_by_path, which I am very happy to do.I have the SQL using the CTE that functions as I expect. I also have SQL that uses a temporary table using SCOPE_IDENETITY in a WHILE loop that also functions as I expect. Both return the correct data set. The next piece of the puzzle is that resulting data set is approximately 1.3 million rows. At that volume, the CTE did not return even after two hours of executing. The While loop solution returns the 1.3 million rows in about one minute.Now the problem comes when I attempt to encapsulate the While loop solution into a single SQL Command. I tried a TVF, but I cannot create a temporary table or turn off IDENTITY_INSERT for a table variable to use SCOPE_IDENTITY. As a Stored Procedure, the data returned after 2:30 minutes, however SSIS cannot read column metadata from a stored procedure. I am open to suggestions on what to try next.Thank you.
↧