|
|
Question : Dynamic Output in SSIS
|
|
In SQL 2000 DTS I am able to build a database from a series of flat files and name the database based on some dynamic/global variables through DTS (see snippet below) how can i accomplish this same task in SSIS and SQL 2005?
SET @cmd='master..xp_cmdshell ''DTSRun /S "' + @Server + '" /U "user" /P "password" /N "hk_import_tempBook_' + @Person + '" /A "gv_destDB:8=HTML_' + @CompanyID + '_' + @BookCode + '" /A "gv_destDBtable:8=[HK_' + @CompanyID + '_' + @BookCode + '].[dbo].[temp_Book]"'', no_output' EXEC (@cmd)
or can i just run these all under the legacy area of SQL 2005?
|
Answer : Dynamic Output in SSIS
|
|
Use Expressions on your Connection Manager. So... I assume you're doing something like a ForEach Enumerator, populating a variable with the name of the file... So in your Flat File Source ConnectionManager, set the ConnectionString to be based on an expression that uses the variable, and in your OLEDB Destination ConnectionManagaer, set the ConnectionString to use the appropriate database.
Or if it's just the table you're needing to tweak, then you can set it to a variable in the OLEDB Destination component. You may need to put a script component in the ControlFlow (in the ForEach Component) to set the variable appropriately before calling the Data Flow.
But... the design of the table must be the same as all the rest. The flow through a table has to be identical. If you're needing to pull a bunch of different files through, then do a Bulk Insert task which uses Expressions instead.
Rob
|
|
|
|
|