Posts

Showing posts from August, 2019

SSIS - Excel data source not taking more characters than 255

Image
Problem: I have developed SSIS package that import multiple excel files into SQL. Now issue is "Excel data source" check first few rows for determine datatype and it took text data type with length 255 for my remarks column. But in some files remarks is longer than 255 chars. I checked some blogs they saying intentional put long text in first row for remarks then SSIS will determine datatype as Unicode text stream. That solved my problem but when other file comes to import datatype again changed to 255 chars and getting truncation error. Please advise how to fix this issue. Solution: Inside the Data Flow Task, right click on the  Excel Source  component, got to  Advanced Editor  >>  Input and Output Properties  Tab, and change the column length manually in the External Columns and Output Columns as shown in the screenshot below. Original post:  https://stackoverflow.com/questions/57644766/in-ssis-excel-datasource-not-taking-...

SSIS - Flat File Source Handling NUL (\x00) value

Image
Problem: I am trying to load data from text files to database. My source files contain null character  NUL somehow (Picture1). I just make all the fields as one column (delimited with  {CR}{LF} ). Then I do the preview of the data. The data is just what we need. But then when I run the package, the data changed, not like what I see in data preview. I added a data viewer to see the data. The number 1 disappear in the first row (see the red). It seems that flat file reading ends at  NUL character. But my Row delimiter is  {CR}{LF} , it doesn't make sense the number 1 in the end disappear. Can anyone tell me why is that? Solution: Reproducing the error First of all, I would like to show the steps to reproduce this error using  Notepad++ editor . I created a text file called  TestNUL  that contains data similar to the screenshot posted in the question (commas are placed where  NUL  objects should be): Now, Go To Edit...

SSIS - Execute Stored Procedure with multiple result sets

Image
Problem: I am using SSIS 2016. I need to execute a stored procedure that returns 4 result sets. I only need to keep the first result set and write this to a table. I can not modify the stored procedure. I do not care about any of the data returned in the other result sets. The stored procedure is in a SQL Server 2016 database. Results will also reside in SQL Server 2016. I currently have this process running in SSIS 2008 using the "SQL Command" data access mode in an OLE DB Source like below. I have this in a For Each Loop Container to pass a series of param values to the stored procedure as I execute it multiple times for different param values on a daily basis. SET FMTONLY OFF ; EXEC myProc @ Param1 = ?, @ Param2 =?, @ Param3 = ?; By default SSIS 2008 is only returning the first result set, which has worked for me as I only care about the first result set. I am using the Native OLEDB SQL Server client. From what I have read, it has changed t...