I need to generate either backups or data dumps for about 30 tables. I want to generate a file of some sort that contains the data for these tables and transfer them to a different system. Each table has 3.8-4.5 million rows. also a large number of these rows have columns with text that has newline characters which need to be handled correctly.
I'm using Sql Server 2012 and have SQL Server Management Studio.
Due to security and other particular reasons I cannot just use SQL Server Managment Studio's Import/Export Wizard for simply exporting tables from one database to another. I have a requirement to get a dump of the data to transfer to a remote system.
I have tried SQL Server Management Studio's Generate Scripts capability, which does appear to handle the newline characters, however There is another issue. In some of the fields the text is similar to "something blah \". that slash causes a problem with the script that gets generated, because the Generate Scripts process wraps that text in '' and with \' it basically escapes the single quote which corrupts the remaining data.
I have also tried to generate flat files via SQL Server Management Studio's Import/Export wizard and this doesn't appear to handle the newline characters correctly and again corrupting the remaining data.
Any help would be greatly appreciated. and I can clarify any information that is missing.
bcpcan handle the requirements stated above. Books Online and the other links on the accepted answer (for the suggested duplicate) contain more information. Once you understand thebcpoptions, test them. If you find a specific issue as a result of that testing, either edit this question with more details (ideally with a sample table structure and data file), or ask a new question, as appropriate. – Paul White Apr 04 '15 at 01:37-nnative format of BCP, so it will be compact and secure (non human readable) as well. – Kin Shah Apr 04 '15 at 01:58BCP INto bring the data into a test table correctly. Thank you all so much for the help – shadonar Apr 08 '15 at 16:47