Regarding the problem when i Import Data to CSV file From Sqlserver
Hi friends,
i have a Problem when i try to import the data from Sql to CSV files.means the data saved in CSV file is fine.but if i have any address fields then that related data come as a new line. for this
i replace the " , " with some another character.
then also i am facing the same problem.so please suggest me how to avoid this problem.
Thanks in Advance,
June 28th, 2012 7:17am
Can you give us some sample data, how the data comes out SSIS now and how you would like the data.MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
June 28th, 2012 7:20am
Hi,
UserID,Address1,Address2
577,Near dalali Bazaar Karatagi,Sri SriShaila Commercials Dalali Bazaar
578,Basaveshwar nagarbasavapur crossKaratagi,Karatagi
586,Dalali Bazaar
Karatagi,Shree Bhaghajothi Enterprises Main Road Apmc Karatagi
588,Karatagi,Sri Sugureshwara Traders
Karatagi
623,J.P. Nagar
Gangavathi
Dt: Koppal,Navali Road
Karatagi
625,J.P. Nagar Venkateshwara Theater Behind
Karatagi,Sri Haravi Basaveshwara Trading Company
Karatagi
this is my csv file in this we have 13 rows but actually we are having only 6 records in DB.
like this format i get the csv file when i save the result set in CSV format.
so please help me..
Thanks in Advance,
June 28th, 2012 9:13am
Does the data contain linefeeds or carriage returns?
SSIS and SQL Server do such things for a reason, they don't start a new line because they feel like it.
Try adding a derived column with the expression:
REPLACE(myColumn, "\r\n", "")
MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
June 28th, 2012 4:19pm
Thanks for u r reply, but till now the problem is not solved.when i place like
REPLACE(myColumn,
"\r\n",
"")
.
but the result come like previous only.
June 29th, 2012 7:36am
Well, I asked first if the data did contain carriage returns and/or line feeds. So you need to investigate that, not blindly copy paste code of the internet into your solution.MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2012 7:54am
Hi Dinesh,
The main way, and near enough the only way, of using "," in import files is not to use commas as your delimiter. For example in Excel you can save your spreadsheet as "tab delimited" which is stored as a text. When reading this file into SSIS
you can set the delimiter to be "tab" and you will have your data in the correct format and with the commas present.
Martin Clarke | Developer BlueHub Solutions
Want to improve the efficiency of your SSIS solutions? Check out
www.bluessis.com
June 29th, 2012 9:15am
@Martin: this thread is about exporting to CSV, not importing from CSV.MCTS, MCITP - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2012 9:20am
Thanks for pointing that out Koen, it seems that the only way to answer Dinesh's question is for him to provide the information you already requested. Which for the sake of getting the request back on track I shall quote:
@Dinesh: "Does the data contain linefeeds or carriage returns?"Martin Clarke | Developer BlueHub Solutions
Want to improve the efficiency of your SSIS solutions? Check out
www.bluessis.com
June 29th, 2012 9:36am
Hi Dinesh,
When exporting the data to flat file, What Row delimiter and Column delimiter you are selecing in Flat File Connection Manager? I suggest you add a dataview to see what data go through in the data flow. For more details about exporting data to a text file using
a package, please see:
https://decipherinfosys.wordpress.com/2008/07/23/ssis-exporting-data-to-a-text-file-using-a-package/
Thanks,
Eileen
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2012 5:28am
Hi Dinesh,
When exporting the data to flat file, What Row delimiter and Column delimiter you are selecing in Flat File Connection Manager? I suggest you add a dataview to see what data go through in the data flow. For more details about exporting data to a text file using
a package, please see:
https://decipherinfosys.wordpress.com/2008/07/23/ssis-exporting-data-to-a-text-file-using-a-package/
Thanks,
Eileen
July 5th, 2012 5:31am