CSV database column edit - database

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.

Related

Inserting Russian characters in table when file is loaded from SSIS

I'm trying to insert some value that is having Russian characters from SSIS.
Say I have a MYDATA.TXT (comma separated) and data as below
REM,DES,ID
FR1,Головка,8
GY2,6-гр,9
MO0,Болт,2
1st row is column headers. I'm using this in Flat file. After executing the task, the value are different in my table something like Головка
After some research I found that i have to use N before the text and column should be NVARCHAR. But i'm not sure how to do this in SSIS. I have around 1.2 million records, should I prefix my column with N for all rows or is there any other way in SSIS?
Try to change the code page to 65001 (UTF-8).
In Advanced tab change the Datatype of DES column to unicode string [DT_WSTR]
Output:

"EmptyHeader" in CSV Export Options?

I have a CSV file I am attempting to create, and the recipient requires a header row. In this header row (and in the data) there is a field that used to be present that was removed. However, they did not remove the column that that held that data, so now, there is an empty column name surrounded by delimiters ("|"). How can I recreate this?
The expected results for the following columns should be:
RxType1|RxType2|RxType3|RxType4|RxType5||DelivID
(There is an empty column between RxType5 and DelivID) and the results would be:
|Rx|OTC|Legend|Generic|Other||Express
I am using SSRS, and have attempted adding an extra pipe the the column header for RxType5 with an empty column behind it, but the CSV seems to generate a header row based on the column names from the stored procedure and not from the RDL data. I have also attempted in the Stored Proc to create the column by using:
Select
'' AS ""
OR
'' AS "|"
but when I refresh the fields in SSRS, it puts that the column is called "ID_" (because a space, no character, or pipe is non-CLS compliant.
Any suggestions on how I can achieve this? Thanks so much :)
Try creating the column with a known name, like SELECT '' AS [RemoveMe], and then just remove that name from the row header text box.

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}

SAP Data Services .csv data file load from Excel with special characters

I am trying to load data from an Excel .csv file to a flat file format to use as a datasource in a Data Services job data flow which then transfers the data to an SQL-Server (2012) database table.
I consistently lose 1 in 6 records.
I have tried various parameter values in the file format definition and settled on setting Adaptable file scheme to "Yes", file type "delimited", column delimeter "comma", row delimeter {windows new line}, Text delimeter ", language eng(English) and all else as defaults.
I have also set "write errors to file" to "yes" but it just creates an empty error file (I expected the 6,000 odd unloaded rows to be in here).
If we strip out three of the columns containing special characters (visible in XL) it loads a treat so I think these characters are the problem.
The thing is, we need the data in those columns and unfortunately, this .csv file is as good a data source as we are likely to get and it is always likely to contain special characters in these three columns so we need to be able to read it in if possible.
Should I try to specifically strip the columns in the Query source component of the dataflow? Am I missing a data-cleansing trick in the query or file format definition?
OK so didn't get the answer I was looking for but did get it to work by setting the "Row within Text String" parameter to "Row delimiter".

Strange Behaviour with Flat File Import

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?

Resources