Strange Behaviour with Flat File Import - sql-server

0I am importing a text file encoded in UTF8 - without BOM usign a flat file source to OLE DATABASE task .
Format of Flat file connection is DELIMITED, 65001(UTF-8), Text Qualifier ( none ) , Header Row delimiter is {CR}{LF} , Header Rows skip is 2 , and the column names in the first data row . Row Delimiter is {CR}{LF} and column Delimiter is Vertical Bar {|}.
Format of data is like so ;
SPECIAL products in q: Reported on 01/11/2011 {CR}{LF}
{CR}{LF}
Serve|Co|Q Number|Doc Name|{CR}{LF}
HE| AUS|000021|Dert|{CR}{LF}
The problem is that SSIS is not seeing the first 112 rows ? I cant work this out . It is driving me crazy so pl help ?
All the other rows in the fiel starting from 113 import into the database with no problems. No errors when SSIS package runs.

Did you check the "Header Rows to Skip" property? Whats the value there?
Also, if you look at the "Preview" of the data in the FF Connection manager, there's a property called "Data Rows to skip". Both these properties should be 0's. What do you see on your FF manager?

Related

Flat file connection manager carriage return/line feed discrepancy

I'm upgrading from SQL Server 2008R2 to 2017, and making the same jump with SSIS. There are a number of flat file imports that are picking up files that have carriage return/line feeds ({CR}{LF}) embedded within a column in the row.
The 2008R2 flat file connection manager ignores the embedded {CR}{LF}s that are within a row, but the flat file connection manager in 2017 is treating each {CR}{LF} as a new line. It's the same in an upgraded connection manager or a brand new one that I make from scratch.
In both versions, the connection managers have the same specs:
General Tab
Locale: English (United States)
Unicode: No
Code page: 1252 (ANSI-Latin I)
Format: Delimited
Text qualifier: <none>
Header row delimiter: {CR}{LF}
Header rows to skip: 0
Column names in the first data row: Check
Columns Tab
Row delimiter: {CR}{LF}
Column delimiter: Vertical Bar{|}
The not particularly complicated text file I'm testing with:
row_id|row_data|empty_column|created_by|one_more_field{CR}{LF}
1|random test data||ebrandt|{CR}{LF}
2|Data field with a carriage return{CR}{LF}
and a line feed embedded in it.||ebrandt|
I pasted on the line terminators, just to show that they're there.
On the Columns tab, the Preview window in BIDS 2008R2 shows two rows:
But in 2017, exactly the same file gets broken into three rows:
There isn't bandwidth in this project to rework all the file imports.
Is there a setting that got changed between versions that I can change back? Or is there another trick to this that I'm missing?
Edit: In response to a comment that's been deleted, I would specify a text qualifier if I could, but the files I'm getting don't have any.
In the Flat File Connection Manager you need to set the AlwaysCheckForRowDelimiters property to False.
Your file will then be parsed as before.
This was a change made in 2012 to change behaviour to the following.
By default, the Flat File connection manager always checks for a row
delimiter in unquoted data, and starts a new row when a row delimiter
is found. This enables the connection manager to correctly parse files
with rows that are missing column fields.
See this link for more about it.

SSIS Flat File - CSV formatting not working for multi-line fileds

I want to import *.csv file. There is head row with the column names, and data rows below. The problem is in column description.This column has multi-line text and each line is recognised as the record.
Document has {CR}{LF} for the end of row, and {LF} for the end of line in multi-line text. Like this:
(0)"Name","Description" {CR}{LF}
(1)"John","adsaddsadas" {CR}{LF}
(2)"Mike","dasdsadsdsda
dsadadsdasdsa {LF}
dsadadsadsad {LF}
dasdsadsadsd"{CR}{LF}
(3)"Dave","dsada"{CR}{LF}
It returns an error saying the row (2) is truncated and is missing data
I have selected {CR}{LF} as delimiter, but it still recognises this as 6 records instead of 3, i suppose it, for some reason, recognises {LF} as row delimiter.
Is there anyone who had similar issue here, or knows how to get over this.
Also i want to mention i don't have a lot of experience with this, so i don't know if there is data missing.
In your flat file connection manager make sure that the Header Row Delimiter is set to {CR}{LF}
And That the Row Delimiter is also set to {CR}{LF}
And Check that Description Column has a length of 4000 (to prevent text from getting truncated) and that the last column delimiter is {CR}{LF}

SSIS Excel column name reading from file

I have a source file, has columns names with length as more than 100.
Column name are same upto 80 characters and remaining 20 characters will be different, please find below example.
ABC_XXXX_MNOAP : XYZABC_PAGELOADER_CLICKS_MANOPD_YXBDBAGD : VIEWS
ABC_XXXX_MNOAP : XYZABC_PAGELOADER_CLICKS_MANOPD_YXBDBAGD : CLICKS & THROGHS
While i am loading this file in to ssis, full column name is not loading and it is trimming.
Error thrown was
There is more than one data source column with same
Please help me how to get full metadata from excel

Why am I getting 0 rows processed in SSIS?

I am creating a SSIS package using MS Visual Studio 2012 Shell with .Net framework of 4.6.01055. The SSIS package has a Data Flow task with Flat File Source, Data Source Row count, Final Data Set count and OleDb destination tasks. It connects to a SQL Database and I have checked to see that my connection has been tested.
I have a flatfile connection manager which picks up a text file. On the Preview section it only shows the header columns in the flat file connection manager editor. The error message is only at warning level with the following message: [Flat File Source [10]] Warning: The end of the data file was reached while reading header rows. Make sure the header row delimiter and the number of header rows to skip are correct. The file itself has a total of 19 rows with the first being the header row.
I have spaces in the header names of the origin file. So on that file I edited to have no spaces on the final column. That did not cure the issue. The last column is a date but I am designating as OutputColumnWidth of 50 and datatype as string[DT_STR]. I have the Row delimiter as {CR}{LF}. I have the column delimiter as {|}. When run the package file name does not change.
In the General section of the editor under locale = English; Unicode is not checked; Code Page = 1252 (ANSI-Latin1); Format = Delimited; Text qualifier = none; Header row delimeter = {CR}{LF} (I have tried just CR or LF as well); Header rows to skip=0 (I have tried 1 as well since there is only one header row); and I have checked Column Names if the first data row.
Why am I not getting data in my preview section? And why is it thinking I only have a header?
It seems to me that your text file does not have a matching EOL marker, and so SSIS never splits the lines (and treats the file as just having one big header).
Try opening the file in a text editor that lets you see the EOL marker. I know that NotePad++ can do this for you.
NotePad++ will also let you change the file's encoding as well, in case that is also a problem.
NB: The problem could also be that you are not specifying a correct column delimiter. If the delimiter you specify in SSIS doesn't match characters in the file, then SSIS will also think that you have a single header row where everything is in the first column.
Just to add to the other answer:
I had the same problem, when i opened the file in notepad, it became clear that there was a trailing empty line at the bottom.
So: make sure the last line of the file actually contains text.

CSV database column edit

I usually have more code oriented questions, but I need help with a CSV database. Basically I need to change it's format to Fname;Lname;email. The problem is that I have 13000 rows and all of the data is in 1 column, the separator is ";". I used different CSV file editors and all of them put the data in 1 column, so I can't change the order of those columns... i cannot re-extract the data from the original database. So is there a fix to that, or am I screwed?
So I am starting with a CSV file, that has ";" between each data cell in each rows. So I open Excel 2016 and I do: data > from text > I find the CSV file > I click on delimited ";", start import on row 1, file origin: Windows (ANSI) > delimiter: ";" > column data format: "General" > finish. And I get all the data in 1 column...
If I understand you...
You could use excel and a vb macro to do the shuffling for you. Split by ';' and put each row in an array, shuffle, and then concatenate?
You can also change the column break when importing a csv in excel.

Resources