Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


mattdrago
2020-05-13T15:21:42Z
when importing data for SQL, bcp is available and a format file can be presented to show column lengths
can this be done with Visual Cron?

example -
example record:
THIS IS A RECORDEXAMPLE

How could I import
Columns 1-5 into field1
Columns 6-10 into field2
Columns 11-12 into field3
Columns 19-25 into field4
Sponsor
Forum information
mattdrago
2022-08-29T22:05:59Z
support - any update on this one?
thomas
2022-08-30T06:45:13Z
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 
mattdrago
2022-08-30T13:30:50Z
thank you for the answer.
i am aware of those things. but what i was looking for was something more like what SQL uses BCP for - it has a format file that parses out fixed length columns.
the data we have isn't delimited - it is fixed length.
i have used PS, SSIS, and even VB jobs to parse out the data. i was hoping for something that Visual Cron supported within its application - using a loop and parsing the data with fixed length, instead of delimited, columns
Scroll to Top