dbTalk Databases Forums  

Problem with delimiters in fields.

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Problem with delimiters in fields. in the microsoft.public.sqlserver.dts forum.



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

Default Problem with delimiters in fields. - 09-09-2005 , 04:21 AM






SQL Server 2000 SP3.

I'm having fierce trouble importing a csv file with only two fields.

The columns are delimited with comma
The rows are delimited with CRLF
The text fields are delimited with double quotes.

The problem I'm having, is any text field with a comma in it is causing the
import to fail.

My understanding was that if a comma is found within a text field (delimited
with quotes)
the parser should ignore it, as it should know that the field hasn't yet
ended.

Are my assumptions correct? and is there a way to force DTS to behave this
way?

Thanks in advance



Reply With Quote
  #2  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: Problem with delimiters in fields. - 09-09-2005 , 08:24 AM






Kagey,

This has been asked before. The only proper way out is changing column
delimiter to something the data does not have. ?, ß, ?, ?, etc. would do in
most cases.

Ilya

"Kagey" <k@c.com> wrote

Quote:
SQL Server 2000 SP3.

I'm having fierce trouble importing a csv file with only two fields.

The columns are delimited with comma
The rows are delimited with CRLF
The text fields are delimited with double quotes.

The problem I'm having, is any text field with a comma in it is causing
the
import to fail.

My understanding was that if a comma is found within a text field
(delimited
with quotes)
the parser should ignore it, as it should know that the field hasn't yet
ended.

Are my assumptions correct? and is there a way to force DTS to behave this
way?

Thanks in advance





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

Default Re: Problem with delimiters in fields. - 09-09-2005 , 12:12 PM



Ilya, I have absolutely no idea what you're talking about. Don't
confuse DTS with bcp. It's one of the basic options in a Text File
source while designing a DTS package. Please don't encourage horrible
horrible ideas like using these bad delimiters. There is a standard way
of handling this in CSV, which DTS handles.

Kagey, create a new test csv file somewhere. Drop the data
"blah","whatever","test,test2" into it and make sure to put a carriage
return at the end of the row. Create a new DTS package. Drop a Text
File Source into the package. Browse to your test file and select it.
Hit the properties button under the file name. Choose Delimited file
from the radio buttons. You'll see that there's a dropdown for Text
Qualifier that says Double Quote. This is what your file is. Hit the
next button. This will let you choose the delimiter and will preview
your data. Select the comma radio button and you'll see in the preview
window that your data gets parsed just like it's supposed to. You will
not have any problems whatsoever.

Bruce Dunwiddie
http://www.csvreader.com

Ilya Margolin wrote:
Quote:
Kagey,

This has been asked before. The only proper way out is changing column
delimiter to something the data does not have. ?, ß, ?, ?, etc. would do in
most cases.

Ilya

"Kagey" <k@c.com> wrote in message
news:urw4G%23RtFHA.3752 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
SQL Server 2000 SP3.

I'm having fierce trouble importing a csv file with only two fields.

The columns are delimited with comma
The rows are delimited with CRLF
The text fields are delimited with double quotes.

The problem I'm having, is any text field with a comma in it is causing
the
import to fail.

My understanding was that if a comma is found within a text field
(delimited
with quotes)
the parser should ignore it, as it should know that the field hasn't yet
ended.

Are my assumptions correct? and is there a way to force DTS to behave this
way?

Thanks in advance




Reply With Quote
  #4  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: Problem with delimiters in fields. - 09-09-2005 , 03:22 PM



Bruce,

By DTS you meant Data Pump Task? Your setup works with it perfectly. There
was another thread about a week ago where the data had row delimiter (CRLF)
in it. Data Pump Task cannot get around this one. My rule is: no delimiters
in the data. Simple. Than the files can be read by any reader regardless. As
far as the horrible ones go we use ß without fail for ages.

Ilya

"shriop" <shriop (AT) hotmail (DOT) com> wrote

Ilya, I have absolutely no idea what you're talking about. Don't
confuse DTS with bcp. It's one of the basic options in a Text File
source while designing a DTS package. Please don't encourage horrible
horrible ideas like using these bad delimiters. There is a standard way
of handling this in CSV, which DTS handles.

Kagey, create a new test csv file somewhere. Drop the data
"blah","whatever","test,test2" into it and make sure to put a carriage
return at the end of the row. Create a new DTS package. Drop a Text
File Source into the package. Browse to your test file and select it.
Hit the properties button under the file name. Choose Delimited file
from the radio buttons. You'll see that there's a dropdown for Text
Qualifier that says Double Quote. This is what your file is. Hit the
next button. This will let you choose the delimiter and will preview
your data. Select the comma radio button and you'll see in the preview
window that your data gets parsed just like it's supposed to. You will
not have any problems whatsoever.

Bruce Dunwiddie
http://www.csvreader.com

Ilya Margolin wrote:
Quote:
Kagey,

This has been asked before. The only proper way out is changing column
delimiter to something the data does not have. ?, ß, ?, ?, etc. would do
in
most cases.

Ilya

"Kagey" <k@c.com> wrote in message
news:urw4G%23RtFHA.3752 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
SQL Server 2000 SP3.

I'm having fierce trouble importing a csv file with only two fields.

The columns are delimited with comma
The rows are delimited with CRLF
The text fields are delimited with double quotes.

The problem I'm having, is any text field with a comma in it is causing
the
import to fail.

My understanding was that if a comma is found within a text field
(delimited
with quotes)
the parser should ignore it, as it should know that the field hasn't yet
ended.

Are my assumptions correct? and is there a way to force DTS to behave
this
way?

Thanks in advance





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.