bcp

Best way to export/import MS Sql 2008 Geography data

£可爱£侵袭症+ 提交于 2019-12-05 02:32:12
(ANSWER) How to export some Geography data from a Microsoft Sql Server 2008. You'll need to use the command line argument BCP to dump the data in it's original (native) format to a binary file. Then on the other server you can bulk insert this binary data back into a table of the same strucutre. here's some code. Export Command Line: bcp "geodata.dbo.GeographyData" out "C:\GeoData.bin" -T -n -S <servername> Notes This uses a Trusted connection use the bcp /? for more help for your export options if u need to be hardcore. Importing the data T-SQL: bulk insert GeographyData from 'C:\GeoData.bin'

Why is BCP so fast?

放肆的年华 提交于 2019-12-04 13:03:51
So BCP for inserting data into a SQL Server DB is very very fast. What is is doing that makes it so fast? In SQL Server, BCP input is logged very differently than traditional insert statements. How SQL decides to handle things depends on a number of factors and some are things most developers never even consider like what recovery model the database is set to use. bcp uses the same facility as BULK INSERT and the SqlBulkCopy classes. More details here http://msdn.microsoft.com/en-us/library/ms188365.aspx The bottom line is this, these bulk operations log less data than normal operations and

Why does bcp output null when the column contains an empty string and empty string when the column is null?

≯℡__Kan透↙ 提交于 2019-12-04 11:04:42
问题 This struck me as really weird behaviour and I spent a while checking for bugs in my code before I found this "out copies from the database table or view to a file. If you specify an existing file, the file is overwritten. When extracting data, note that the bcp utility represents an empty string as a null and a null string as an empty string." (from http://msdn.microsoft.com/en-us/library/ms162802.aspx) Obviously this allowed me to fix my problem but can anybody think of or does anybody know

How do I use boost bcp?

情到浓时终转凉″ 提交于 2019-12-04 06:12:15
I have the bcp tool, it came pre-built with the boost installer. I'd like to extract the dependencies I need from boost into a smaller file, since I'd like to be able to build this project at school. I'm trying to use bcp, but I don't understand how to use it, despite these instructions: http://www.boost.org/doc/libs/1_52_0/tools/bcp/doc/html/index.html#bcp.syntax I've tried typing: bcp boost/thread.hpp /"E:\documents\Dropbox\School\Comp 445\Comp445_Assign2_v2\boost2" from the command prompt, from within my boost folder: C:\Program Files (x86)\boost\boost_1_51 It just spits out a "usage" guide

Sybase BCP vs MS SQL BCP

Deadly 提交于 2019-12-04 05:14:02
问题 I have a multi-database setup that I need to work with and both have their own bcp versions that do not act the same way. Plus both are in my %PATH% and the Sybase one is listed before the MS SQL exe so calling "bcp" from the command line always hits the Sybase exe. First, the versions are "different": Sybase BCP: Sybase CTBCP Utility/15.0/P-EBF17890 ESD #24/PC Intel/BUILD1500-123/OPT/Thu May 13 02:45:43 2010 (for Adaptive Server Enterprise/15.7/EBF 23008 SMP SP130 /P/RS6000/AIX 6.1

What is the best way to save XML data to SQL Server?

ⅰ亾dé卋堺 提交于 2019-12-04 02:56:14
Is there a direct route that is pretty straight forward? (i.e. can SQL Server read XML) Or, is it best to parse the XML and just transfer it in the usual way via ADO.Net either as individual rows or perhaps a batch update? I realize there may be solutions that involve large complex stored procs--while I'm not entirely opposed to this, I tend to prefer to have most of my business logic in the C# code. I have seen a solution using SQLXMLBulkLoad, but it seemed to require fairly complex SQL code. For reference, I'll be working with about 100 rows at a time with about 50 small pieces of data for

SQL Server BCP Export where comma in SQL field

只愿长相守 提交于 2019-12-04 02:11:32
问题 I have successfully exported a file to a CSV. I used the following code to export the file: exec xp_cmdshell 'bcp "[DC_TrainEnvironment].[dbo].[HAFacilities_Master]" out "\\fspincdc01\data$\HIMSSAnalytics\Data Analyst\HG Data\Technical Documentation\HA Facilities\HAFacilities_Master.csv" -f "\\fspincdc01\data$\HIMSSAnalytics\Data Analyst\HG Data\Technical Documentation\HA Facilities\HAFacilities_Master_FORMAT.fmt" -o "\\fspincdc01\data$\HIMSSAnalytics\Data Analyst\HG Data\Technical

BCP to CSV file with commas in the data

一笑奈何 提交于 2019-12-03 21:05:47
问题 I have a BCP process that is calling a stored procedure. Typically I have been executing this stored procedure and copying the data to an Excel sheet that I specifed all columns as text and saved this as a CSV. I need to automate this work and have been playing with the BCP command but so far have an issues. The data I have has commas in it which shifts data to the left. Is this something I can overcome with a format file or something of the sort? I would rather not quote these in the output

SQL Server BCP: How to put quotes around all fields?

邮差的信 提交于 2019-12-03 19:31:13
问题 I have this BCP command: 'bcp DBName..vieter out c:\test003.txt -c -T /t"\",\"" -S SERVER' The output CSV I get does not put quotes around the field names, instead it puts it around the commas! How can I get the /t"\",\"" to put quotes around all fields. Thanks all 回答1: Setting the row terminator in addition to the field terminator should do the trick 'bcp DBName..vieter out c:\test003.txt -c -T -t"\",\"" -r"\"\n\"" -S SERVER' This will likely work, but miss off the leading " for the first

Getting a buildable Boost extract with bcp

大兔子大兔子 提交于 2019-12-03 13:59:07
问题 I'm using bcp to extract Boost.Archive from Boost. Unfortunately I can't build this extract. Boost.Archive is not a header-only library. bjam complains Unable to load Boost.Build: could not find "boost-build.jam" Is there any way to tell bcp to make the extract buildable with bjam (copy boost-build.jam to the right place)? 回答1: The right place would be any parent directory of the directory where you have extracted Boost.Archive (or that directory itself). That file shall contain a single line