Solved

Export data from MSSQL server into csv file and publish it on linux webserver - CODEPAGE problem

Posted on 2004-04-06
10
1,334 Views
Last Modified: 2010-05-18
SITUATION:
We have a MSSQL server from which we Export limited amount of data into CSV (comma separated value) file, and publish this data on webserver using linux.

PROBLEM:
The data exported into csv file is not properly shown. Some characters like čćžđš or ČĆŽĐŠ are corupted.
When i look into file with NOTEPAD on Windows - its perfect, but when I look it in Linux its corrupted

QUESTION:
How to export data from MSSQL server into desired codepage (iso-8859-2).

Thanx,

Peter
0
Comment
Question by:petrusko
  • 5
  • 3
  • 2
10 Comments
 

Author Comment

by:petrusko
ID: 10765514
Sory but your editor changed my characters into html chars!

Please help.

Peter
0
 
LVL 34

Expert Comment

by:arbert
ID: 10765625
You can use BCP with the queryout option to export Unicode data to a text file.
0
 

Author Comment

by:petrusko
ID: 10765639
Ok - tell me please what is BCP?

Peter
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 34

Accepted Solution

by:
arbert earned 300 total points
ID: 10765680
0
 

Author Comment

by:petrusko
ID: 10766416
superb - one final question:
How to add field names with bcp?

Peter
0
 
LVL 13

Assisted Solution

by:danblake
danblake earned 200 total points
ID: 10767164
Some characters like čćžđš or ČĆŽĐŠ are corupted.
--> There is a file format difference between Linux Systems and Windows system, you need to convert the file from Windows -> Linux.

Here's a free tool for any other files that you need to convert from ascii windows -> linux.
http://www.thefreecountry.com/tofrodos/index.shtml
0
 
LVL 34

Expert Comment

by:arbert
ID: 10771033
What do you mean add fieldnames with bcp?  With queryout/out you specify the query on the command line "select col1, col2, col3 from yourtable"....

Brett
0
 

Author Comment

by:petrusko
ID: 10772173
To arbert:
When I use BCP I only get data from MSSQL - but not names of fields.

I would like to get field names into first row of CSV file, like this

ID;Addres;Zip;Phone
1;2nd Avenue;12345;01-213-123-321
2;3rd Bulevard;12345;01-321-321-321
.
.
.

0
 

Author Comment

by:petrusko
ID: 10772230
To danblake:
--Tofrodos is a text file conversion utility that converts ASCII files between the MSDOS (or
--Windows) format, which traditionally have CR/LF (carriage return/line feed) pairs as their new
--line delimiters, and the Unix format, which usually have LFs (line feeds) to terminate each line.

tofrodos only converts CR/LF to LF - but it does not convert the data from one codepage to another.

Thanx anyway - Peter
0
 
LVL 13

Expert Comment

by:danblake
ID: 10772468
You can use the BCP utility to specify your code page using -C <code_page id>, if unicode is not required.
BCP only normally creates an independant format file (using the -format), once this has been created can you write a utility to transpose the text from the format file (each line represents a different  column) and then convert this into a single line and append the contents of the second file to the begginig of the first (with the correct row delimiter -- hence the tofrodos).
Or you will need to use something like osql to return a list of headings using a specified column seperator (but this will not necesarily output as the code page you require).

There are also plenty of multi-language unicode code page conversion tools between platforms....(including linux/unix).
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question