In the example above, you want to import 'THIS' into field1, 'IS' into field2 and so on. Is that right? If so there a many ways of doing this with VisualCron.
1) You could loop over the file lines, split by column delimiter (use functions 'get column by row...'), and then do an insert statement. If your file is fixed length (not delimited), you will have to use a substring function or something. In my opinion this is
by far the worst way of doing this. You open and close a connection for every row, you will commit on every row so there is no transactions/rollback available to you if something fails. It is going to be superslow for big files. It is maybe ok for very small files, but I would stay away from this option
2) In the sql task you can write anything you like, so importing with format files (bcp/openrowset) can be done in that task. We used to do it this way. It works fine and is performant.
3) Call an SSIS task that imports the file. Assumes you know SSIS, so not for everyone.
4) You can call a powershell task. dbatools have a million scripts you can use:
https://docs.dbatools.io/Import-DbaCsv.html
Edited by user
2022-08-30T06:52:12Z
|
Reason: Not specified