Reputation: 29120
I am trying to use the MS SQL Server 2005 Import/Export tool to export a table so I can import it into another database for archival. One of the columns is text so if I export as comma-delimited, when I try to import it into the archive table, it doesn't work correctly for rows with commas in that field. What options should I choose to ensure my import will work correctly?
Upvotes: 1
Views: 14556
Reputation: 29120
Over a year later, I now have an ideal solution to my data export needs, thanks to https://stackoverflow.com/questions/20363/
bcp "SELECT * FROM CustomerTable" queryout "c:\temp\CustomerTable.bcp" -N -S SOURCESERVERNAME -T
bcp TargetDatabaseTable in "c:\temp\CustomerTable.bcp" -N -S TARGETSERVERNAME -T -E
Very quick and easy to embed within code.
Upvotes: 3
Reputation: 96600
I never use the comma delimter unless the client requires it. Try using | as a delimter. YOu can also use the text qualifier if need be.
Upvotes: 2
Reputation: 402
Use quotes as text qualifier
Text qualifier: Type the text qualifier to use. For example, you can specify that each text column be surrounded with quotation marks.
Upvotes: 0