dbTalk Databases Forums  

Stray control characters in CSV Export from Management Studio

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss Stray control characters in CSV Export from Management Studio in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kwdavids
 
Posts: n/a

Default Stray control characters in CSV Export from Management Studio - 07-15-2008 , 08:26 AM






I have a very simple result set displayed in a Grid in Microsoft SQL
Server Management Studio (2005) that I want to save as a CSV file. I
right click on the grid, select Save Results As... and save the file.
The file looks like this in a text editor:

1,1,1
2,2,2
3,3,3
....

But when I try to open it in Excel, it's not parsed right. Examination
with a Hex editor shows a leading Hex ff fe, plus a null between each
character.

Here's what I got from Management Studio:

ff fe 31 00 2c 00 31 00 2c 00 31 00 0d 00 0a 00 32 00 2c 00 32 00 2c
00 32 00 0d 00 0a 00 33 00 2c 00 33 00 2c 00 33 00 0d 00 0a 00 34 00
2c 00 34 00 2c 00 34 00 0d 00 0a 00 35 00 2c 00 35 00 2c 00 35 00 0d
00 0a 00 36 00 2c 00 36 00 2c 00 36 00 0d 00 0a 00 37 00 2c 00 37 00
2c 00 37 00 0d 00 0a 00 38 00 2c 00 38 00 2c 00 38 00 0d 00 0a 00 39
00 2c 00 39 00 2c 00 39 00 0d 00 0a 00 31 00 30 00 2c 00 31 00 30 00
2c 00 31 00 30 00 0d 00 0a 00

This is what is normal:

31 2c 31 2c 31 0d 0a 32 2c 32 2c 32 0d 0a 33 2c 33 2c 33 0d 0a 34 2c
34 2c 34 0d 0a 35 2c 35 2c 35 0d 0a 36 2c 36 2c 36 0d 0a 37 2c 37 2c
37 0d 0a 38 2c 38 2c 38 0d 0a 39 2c 39 2c 39 0d 0a 31 30 2c 31 30 2c
31 30

It's a real pain not being to simply open these files in Excel.

Kevin

Reply With Quote
  #2  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM






On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
  #3  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM



On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
  #4  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM



On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
  #5  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM



On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
  #6  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM



On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
  #7  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM



On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
  #8  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM



On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
  #9  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM



On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
  #10  
Old   
kwdavids
 
Posts: n/a

Default Re: Stray control characters in CSV Export from Management Studio - 07-15-2008 , 09:27 AM



On Jul 15, 9:26*am, kwdavids <kwdav... (AT) gmail (DOT) com> wrote:

...

OK, I learned that the format is Unicode. Two things are broken in my
mind. First SQL server can't save an ASCII CSV file. Excel is broken
in that it can't open a Unicode CSV file.

Keivn

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.