| Article: |
Faster Filtered SQL Server Imports | |
| Subject: | Questions about BCP and CPAN | |
| Date: | 2007-01-06 23:17:21 | |
| From: | glasswalk3r | |
|
Hello there,
|
||
Showing messages 1 through 5 of 5.
-
Questions about BCP and CPAN
2007-01-08 08:06:09 CPG [Reply | View]
-
Publishing on CPAN
2007-01-16 11:26:51 glasswalk3r [Reply | View]
Hello there,
I've been working in a API layer over Win32::OLE and MS SQL Server API to fetch data related to DTS packages. This API hides all complex structures required from Win32::OLE and, with some degree of luck, the need to convert VBscript from the SQL Server documentation.
Probably I'll take a namespace simple as "DTS". Till now, I have just some classes representing the DTS tasks like SendMailTask and ExecutePackageTask. I had used this API successfully to implement unit tests in the DTS packages I had to develop as ETL interfaces in a project I had worked.
I'll probably publish it on CPAN in a week or two. Maybe you would like to extend the DTS::Task class to implement the BulkInsertTask object. ;-)
-
Questions about BCP and CPAN
2007-01-15 01:21:41 CPG [Reply | View]
As an example of the flexibility of using this DTS module, you only need to adjust two parameters to import fixed width data from a file. In the connectToFile() subroutine, set the ‘File Format’ to 2, and replace the ‘Column Delimiter’ parameter with ‘Column Lengths’, set to the lengths of the fixed width fields. For example, if there are three fields of length 6, 25 and 25, use the following settings (passed as parameters):-
$Conn->ConnectionProperties->{"File Format"}->{Value} = 2;
$Conn->ConnectionProperties->{"Column Lengths"}->{Value} = "6,25,25";




1. The simple answer is that, before I wrote this module, I used DTS rather than BCP for my data loading. BCP probably would have been quicker for bulk loading data from flat-files, but it did not have the flexibility of DTS for controlling the different data sources, performing data transformations, etc. The article gives an example of working with the DTS object model but, due to space considerations, does not use the full range of available DTS features.
2. I had not planned to put this on CPAN, but if people were interested, I could do.