Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

SQL 2008 Export to CSV. Numeric Fields quoted. WHY?

 
   Database Help (Home) -> Tools RSS
Next:  sql 2008 express  
Author Message
JOHN KEANE

External


Since: Nov 19, 2008
Posts: 1



(Msg. 1) Posted: Wed Nov 19, 2008 5:47 am
Post subject: SQL 2008 Export to CSV. Numeric Fields quoted. WHY?
Archived from groups: microsoft>public>sqlserver>tools (more info?)

I created a test table to demonstrate my problem.

CREATE TABLE [dbo].[TestExport](
[F1] [char](5) NOT NULL,
[F2] [decimal](9, 0) NOT NULL,
[F3] [decimal](5, 2) NOT NULL,
[F4] [decimal](6, 2) NOT NULL,
[F5] [numeric] (9, 0) NOT NULL)
Insert into testexport select 'REC1', 1, 1, 1, 1
Insert into testexport select 'REC2', 2, 2, 2, 2
Insert into testexport select 'REC3', 3, 3, 3, 3
Insert into testexport select 'REC4', 4, 4, 4, 4
Insert into testexport select 'REC5', 5, 5, 5, 5

select * from testexport

Using SQL Server 2008, I click on the database, then Tasks, then export data
to start the SQL Server Import and Export Wizard.

I use the default "SQL Server Native Client 10.0: to access the source
database and select "Flat File Destination" for the output.
I give the output file a "csv" extension, format="delimited", text qualifier
= " (I enter a double quote in the field) and ask for the column names to be
in the first row.

Row delimiter is "{CR}{LF}" and column delimiiter is "Comma {,}"

The following is displayed:
Click Finish to perform the following actions:


Source Location : WDSAPPS07
Source Provider : SQLNCLI10

Copy rows from [dbo].[TestExport] to d:\temp\test.csv
The new target table will be created.

The package will not be saved.
The package will be run immediately.

Provider mapping file : C:\Program Files\Microsoft SQL
Server\100\DTS\MappingFiles\MSSQLToSSIS10.XML

The output files content is:

"F1","F2","F3","F4","F5"
"REC1 ","1","1.00","1.00","1"
"REC2 ","2","2.00","2.00","2"
"REC3 ","3","3.00","3.00","3"
"REC4 ","4","4.00","4.00","4"
"REC5 ","5","5.00","5.00","5"

Why do the numeric fields have quotes around them?

JK

 >> Stay informed about: SQL 2008 Export to CSV. Numeric Fields quoted. WHY? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
CPU data in 2008 profiler - Hi all, I tried to run some profiles with SQL Server Profiler, but all completed transactions will shows 0 CPU. i was running SQL Server 2008 CTP 5 on Windows Server 2008 RC 1 (Standard edition). All data gathering on TSQL and SP was enabled. Any..

SQL Stripes - 2008 Edition - SQL Stripes Enterprise has an exciting new version dubbed the "2008 Edition" Some of the new features that can be found on the new version: ------ Added UDA - User Defined Applications - allowing the user to define & integrate his own app...

[Sql Server 2008 RCO]Where is SSMS ? -

How get column headers in QA CSV export -

SSMS 2008 - Error on registered server list - Hi, I 've just installed SS 2008 Developer Edition in my machine. It is running side by side with a SS 2005 Developer Edition. After installed (the setup worked fine without problems) I got the following error when I tried to connect to a server: ....
   Database Help (Home) -> Tools All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]