August 18, 2014 at 3:36 pm
I want to export one table but text contains ',' so can I use double " ? I don't see option when I select delimiter how should I do it.?
August 18, 2014 at 3:52 pm
I have text which is causing me issue
Text having data with value '369 Pacific ave, NC. (07818)'
August 21, 2014 at 1:02 pm
These are not the best ways likely, but a couple of ideas I have are:
1) Use SSIS and a script component with a dataflow to add text qualifiers to your output columns.
2) Query the table using For XML Path('') to create a xml output of the data.
----------------------------------------------------
August 21, 2014 at 8:06 pm
Nita Reddy (8/18/2014)
I want to export one table but text contains ',' so can I use double " ? I don't see option when I select delimiter how should I do it.?
Pick a different delimiter. TAB is easy.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 22, 2014 at 3:42 am
MMartin1 (8/21/2014)
These are not the best ways likely, but a couple of ideas I have are:1) Use SSIS and a script component with a dataflow to add text qualifiers to your output columns.
2) Query the table using For XML Path('') to create a xml output of the data.
If it's just one table and particularly if it contains a lot of rows (hundreds of thousand or more) I'd use bcp; you don't need to worry about a delimiter then, but if you want to use SSIS then as Jeff said, pick a different delimiter. I usually use | (pipe) or ^ .
Regards
Lempster
August 22, 2014 at 6:06 pm
Following up on the BCP suggestion this is actually a good idea >
Open a command line window and type something like
bcp "adventureWorks2008R2.Person.address" out "c:\myBcpOut.txt" -c -T
If you need to supply user name and password (if you are not on a trusted network) then instead of the -T you will have to supply values for the -U and -P switches (-Umyusername -Pmypassword)....if you are logged into the machine you will not need to add a server name to the -S switch.
I did the above, the table I used has commas in the address line field. I was able to open the tab delimited file in Excel and all was properly aligned.
Give it a go
----------------------------------------------------
August 22, 2014 at 11:42 pm
Nita Reddy (8/18/2014)
I want to export one table but text contains ',' so can I use double " ? I don't see option when I select delimiter how should I do it.?
Quick suggestion, use the (close to industry standard) CSV (RFC-4180) format with ["] text qualifiers. Should be no problem at all.
😎
August 24, 2014 at 9:55 pm
Eirikur Eiriksson (8/22/2014)
Nita Reddy (8/18/2014)
I want to export one table but text contains ',' so can I use double " ? I don't see option when I select delimiter how should I do it.?Quick suggestion, use the (close to industry standard) CSV (RFC-4180) format with ["] text qualifiers. Should be no problem at all.
😎
Better yet, don't use commas for delimiters. Use TABs instead. The folks on the receiving end of the data will love you for it.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 25, 2014 at 10:31 am
Better yet, don't use commas for delimiters. Use TABs instead. The folks on the receiving end of the data will love you for it.
Agreed, if you have not already, try the BCP suggestion. I give a command example (above) that will generate a tab delimeted file.
----------------------------------------------------
August 25, 2014 at 11:27 am
MMartin1 (8/25/2014)
Better yet, don't use commas for delimiters. Use TABs instead. The folks on the receiving end of the data will love you for it.
Agreed, if you have not already, try the BCP suggestion. I give a command example (above) that will generate a tab delimeted file.
Agreed. If the people receiving the data have some columns with some rows quoted and some not, how do you think they'll react?
August 25, 2014 at 1:01 pm
Feel I'm starting to repeat my self on the issue:pinch:
Using the RFC-4180, commas and double quotes within a column/field/attribute are not a problem. The problem is more that many of the tools available are not compliant to this RFC, that in my opinion is what needs to be fixed. Switching from one delimiter to another is a form of procrastination, not a solution.
😎
August 25, 2014 at 5:20 pm
Eirikur Eiriksson (8/25/2014)
Feel I'm starting to repeat my self on the issue:pinch:
BWAAA-HAAA!!! Me too!
Switching from one delimiter to another is a form of procrastination, not a solution.
I'll have to register my strong disagreement with that statement. 😉 For example, TSV is so much easier to implement that switching the delimiter to TABS IS one of the better solutions. The CSV standard that you've cited is fraught with vertical (inconsistent) exceptions that cause a world of hurt for those that have to import it. TSV solves most of those problems, especially in the world of BULK INSERT, quickly and easily.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 25, 2014 at 9:42 pm
Jeff Moden (8/25/2014)
Eirikur Eiriksson (8/25/2014)
Feel I'm starting to repeat my self on the issue:pinch:BWAAA-HAAA!!! Me too!
Switching from one delimiter to another is a form of procrastination, not a solution.
I'll have to register my strong disagreement with that statement. 😉 For example, TSV is so much easier to implement that switching the delimiter to TABS IS one of the better solutions. The CSV standard that you've cited is fraught with vertical (inconsistent) exceptions that cause a world of hurt for those that have to import it. TSV solves most of those problems, especially in the world of BULK INSERT, quickly and easily.
Until a field/record/column contains TAB characters then oops lets switch to PIPE....;-)
😎
September 3, 2014 at 10:00 pm
Eirikur Eiriksson (8/25/2014)
Jeff Moden (8/25/2014)
Eirikur Eiriksson (8/25/2014)
Feel I'm starting to repeat my self on the issue:pinch:BWAAA-HAAA!!! Me too!
Switching from one delimiter to another is a form of procrastination, not a solution.
I'll have to register my strong disagreement with that statement. 😉 For example, TSV is so much easier to implement that switching the delimiter to TABS IS one of the better solutions. The CSV standard that you've cited is fraught with vertical (inconsistent) exceptions that cause a world of hurt for those that have to import it. TSV solves most of those problems, especially in the world of BULK INSERT, quickly and easily.
Until a field/record/column contains TAB characters then oops lets switch to PIPE....;-)
😎
True enough... that's when then sometimes find out that they have both TABs and PIPEs in their data. It would be a lot simpler if we went back 40 years and used the correct ASCII characters for text data transmissions... characters 28 through 31 in the ASCII table.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 3, 2014 at 10:17 pm
Jeff Moden (9/3/2014)
Eirikur Eiriksson (8/25/2014)
Jeff Moden (8/25/2014)
Eirikur Eiriksson (8/25/2014)
Feel I'm starting to repeat my self on the issue:pinch:BWAAA-HAAA!!! Me too!
Switching from one delimiter to another is a form of procrastination, not a solution.
I'll have to register my strong disagreement with that statement. 😉 For example, TSV is so much easier to implement that switching the delimiter to TABS IS one of the better solutions. The CSV standard that you've cited is fraught with vertical (inconsistent) exceptions that cause a world of hurt for those that have to import it. TSV solves most of those problems, especially in the world of BULK INSERT, quickly and easily.
Until a field/record/column contains TAB characters then oops lets switch to PIPE....;-)
😎
True enough... that's when then sometimes find out that they have both TABs and PIPEs in their data. It would be a lot simpler if we went back 40 years and used the correct ASCII characters for text data transmissions... characters 28 through 31 in the ASCII table.
Sarting to look like a good case for XML
😎
BTW one should not need that ASCII reference, one must know this by heart like any other alphabet:-D
Viewing 15 posts - 1 through 15 (of 18 total)
You must be logged in to reply to this topic. Login to reply