Author |
Topic |
laddu
Constraint Violating Yak Guru
332 Posts |
Posted - 2010-06-22 : 16:25:16
|
Sofar We are providing the db data to client in excel files using import/export wizard in sql server 2005.Now client is asking the tables data in saperate CSV files in unix format. is it possible?As far as I know SQL Server 2005 runs on Windows system. Please advice |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-06-22 : 16:30:11
|
Look in Books Online under "bcp utility". |
 |
|
laddu
Constraint Violating Yak Guru
332 Posts |
Posted - 2010-06-23 : 10:06:17
|
Any thoughts on how convert the CSV Windows file to CSV unix format? Is there any feature available in SQL Server, or do we have any third party tools available? |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-06-23 : 11:54:45
|
bcp should handle it directly, using \r as the row terminator. I know it can import Unix files without conversion. |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-06-23 : 13:22:55
|
Looks like I was wrong on bcp. It won't export to a using 0x0A as the row terminator (Unix style). There are however command-line utilities that can do the conversion for you. |
 |
|
laddu
Constraint Violating Yak Guru
332 Posts |
Posted - 2010-06-23 : 13:42:19
|
Changing the row delimiter to only LF makes it compatible with UnixPlease let me know whether it is correct? |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-06-23 : 14:50:32
|
Yes, Windows is CR-LF (0x0D0A) and Unix is LF (0x0A). |
 |
|
laddu
Constraint Violating Yak Guru
332 Posts |
Posted - 2010-06-24 : 09:56:18
|
Thank you,I have used SQL IMPORT/EXPORT and successfully exported data into CSV file (Unix format).But I have a issue with data/time format. Some of the fields only display Hour and Minute, instead of HH:MM:SS.I need the following formatMM/DD/YYYY HH:MM:SS AM/PM |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-06-24 : 10:36:37
|
If they are stored as datetime, you can format them for your output using the CONVERT function (see Books Online). If they're stored as varchar, you'll need to convert them to datetime first. If all you have is hour and minute, you'll have to concatenate a date and seconds to the value before converting. |
 |
|
|