In my parallel job I am writing data to a Sequential stage file. Its a comma delimited file.With all Varchar coloumns in source. As per Seq stage all varchar coloumn data is quote when writtent to file though we have option to remove the quotes. But it should double quote data with comma in it.
In detail
for source col1 col2 col,3 out put should be col1,col2,"col,3"
assuming all the above as varchar how to make sure that only col3 has give double quotes in target file
Delimiter Handling
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 15
- Joined: Mon Apr 23, 2012 12:28 pm
Your English was fine, no worries there.
First, why worry about the quotes? They certainly don't hurt so there's no reason that I can see to try and only put them only around values that "need" them. However, I would think you could write out the file without quoted strings and manually add quotes as part of the data when you detect a comma in the field to get that behaviour.
First, why worry about the quotes? They certainly don't hurt so there's no reason that I can see to try and only put them only around values that "need" them. However, I would think you could write out the file without quoted strings and manually add quotes as part of the data when you detect a comma in the field to get that behaviour.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 15
- Joined: Mon Apr 23, 2012 12:28 pm
You solve the problem by allowing the stage to quote all string fields. However, I as said, you can get the output you want by handling the quotes yourself. The Index() function can be used to detect the presence of a comma in your data and drive an if-then-else expression to wrap the value in double-quotes only when needed.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers