我有一个存储过程,它从父proc获取目标表和列列表并加载目标表。一切都在proc本身完成。如何将proc的加载部分转换为SSIS包。这是插入的proc部分。
SET @sql_query = 'TRUNCATE TABLE [snaps].' + QUOTENAME(@table_dst)
EXEC (@sql_query)
--Build the query to load from SQL Server source.
IF @src_type = 'sql_server'
SET @sql_query = 'INSERT INTO [snaps].' + QUOTENAME(@table_dst) + ' (' + @columns_dst_real + ') '
+ 'SELECT ' + @columns_dst_converted + ' '
+ 'FROM ' +
+ '(' +
+ 'SELECT [' + REPLACE(REPLACE(@columns_src, '''', ''''''), ',', '],[') + '] '
+ 'FROM ' + ISNULL(QUOTENAME(NULLIF(@link,'')) + '.', '') + ISNULL(QUOTENAME(NULLIF(@database,'')) + '.', '') + ISNULL(QUOTENAME(NULLIF(@schema,'')) + '.', '') + QUOTENAME(@table_src) + ' WITH (NOLOCK)'
+ ISNULL(' WHERE ' + @where_clause, '') +
+ ') a'
--Build the query to load from Oracle source.
ELSE IF @src_type = 'oracle'
SET @sql_query = 'INSERT INTO [snaps].' + QUOTENAME(@table_dst) + ' (' + @columns_dst_real + ') '
+ 'SELECT ' + @columns_dst_converted + ' '
+ 'FROM OPENQUERY(' + QUOTENAME(@link) + ', '''
+ 'SELECT ' + REPLACE(@columns_src, '''', '''''') + ' '
+ 'FROM ' + @schema + '.' + @table_src
+ ISNULL(' WHERE ' + REPLACE(@where_clause,'''',''''''), '') + ''')'
--Build the query to load from a query source.
ELSE IF @src_type = 'pass_query'
SET @sql_query = 'INSERT INTO [snaps].' + QUOTENAME(@table_dst) + ' (' + @columns_dst_real + ') '
+ 'SELECT ' + @columns_dst_converted + ' '
+ 'FROM OPENQUERY(' + QUOTENAME(@link) + ', ''' + REPLACE(@query_src,'''','''''') + ''')'