bcp

Exporting all tables into files from SQL Server database using utility bulk copy

六眼飞鱼酱① 提交于 2019-12-08 04:23:41
问题 I want to bcp all tables into files from a database: SELECT 'EXEC xp_cmdshell ''bcp ' --bcp + QUOTENAME(DB_NAME())+ '.' --database name + QUOTENAME(SCHEMA_NAME(SCHEMA_ID))+ '.' -- schema + QUOTENAME(name) -- table + ' out c:\temp\' -- output directory + REPLACE(SCHEMA_NAME(schema_id),' ','') + '_' + REPLACE(name,' ','') -- file name + '.txt -T -c''' -- extension, security FROM sys.tables it produces statements like this: EXEC xp_cmdshell 'bcp [AdventureWorks2012].[Production].[ScrapReason]

Copying large amounts of data into a SQL CE database

感情迁移 提交于 2019-12-08 01:26:37
问题 If I have a large amount of data in memory, what is the best way to copy it into a SQL CE table? The current technology stack is C#, ADO.net, and SQL CE. My initial idea was to do one INSERT statement for each row of data, but this is time-consuming. Is there an easier way? 回答1: The first thing that popped into my head was to do a sync/merge with a desktop or server database, though that doesn't sound like it really fits your needs. So here is my second thought: BULK INSERT table_name FROM

character encoding issue with the BCP and ó

孤街醉人 提交于 2019-12-07 14:42:44
问题 I have a file that needs to go to Poland. In my data I have an ó . When I output the data to a table the ó is still there as the field is NVARCHAR . When I cut and paste from the table into Excel or Notepad++ the ó stays When I use the BCP utility to export the data, the ó is changed to a ¢ if I open the resulting text file in Excel or Notepad++. If I change the encoding sometimes the character becomes a ˘ . I have tried the following command line switches, one at a time. -n -N -w 回答1: Have

What are the binary storage formats for sqflt8, sqlmoney and other native SQL data types?

﹥>﹥吖頭↗ 提交于 2019-12-06 22:24:33
问题 According to the documentation, native (binary) data can be imported or exported with bcp formatted in the native SQL Server data formats. Examples of these are SQLFLT8, SQLFLT4, SQLMONEY or SQLNUMERIC. Does anyone know either what the data formats for the various types are, or where documentation specifying these formats might be found. For example, is a SQLFLT8 stored as an IEEE double precision number or in some other format? Edit: From the answers by kevchadders and Andrew I had a little

Copying large amounts of data into a SQL CE database

拜拜、爱过 提交于 2019-12-06 13:25:51
If I have a large amount of data in memory, what is the best way to copy it into a SQL CE table? The current technology stack is C#, ADO.net, and SQL CE. My initial idea was to do one INSERT statement for each row of data, but this is time-consuming. Is there an easier way? The first thing that popped into my head was to do a sync/merge with a desktop or server database, though that doesn't sound like it really fits your needs. So here is my second thought: BULK INSERT table_name FROM data_file I am not sure if it is supported in your version of SQL CE (though it appears to be supported in 3.5

BCP import all files from a folder to database

那年仲夏 提交于 2019-12-06 13:16:57
BCP Import How to do BCP import with all files in a folder. folder file1.csv file2.csv Need to import both the files. bcp <tableName> in <filename> -t "^" -r "\n" -c -C 28591 -S <databaseinstance> -U <username> -P <password> Using the above BCP cmd, we can import only one file at a time. devanathan simple BCP command import only single file. To achieve the above we need to use looping with the command. I have used the following command simple command. for /r %i in (*) do bcp <tablename> in %i -t "^" -r "\n" -c -C 28591 -S <databaseinstance> -U <username> -P <password> It works. 来源: https:/

Why is BCP so fast?

喜夏-厌秋 提交于 2019-12-06 06:43:50
问题 So BCP for inserting data into a SQL Server DB is very very fast. What is is doing that makes it so fast? 回答1: 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

How to write using BCP to a remote SQL Server?

杀马特。学长 韩版系。学妹 提交于 2019-12-05 12:11:15
I have a remote SQL Server with a hostname I am using to connect to. BCP suggests to use bcp DBName.dbo.tablename in C:\test\yourfile.txt -c -T -t However when I try this it does not connect to DBName as that is not a valid alias. I get native error 2. How to I run BCP but specify an internet / network address to connect to, not an MSSQL server name? How to I run BCP but specify an internet / network address to connect to, not an MSSQL server name? You can specify the IP address (here just 127.0.0.1) instead of the server name. bcp DBName.dbo.tablename in "C:\test\yourfile.txt" -c -T -t -S"127

Does sybase 15 support the bcp api in java?

狂风中的少年 提交于 2019-12-05 06:10:09
A long time ago I figured out that bcp is just a little C program that calls the special bit of the sybase client api to do mass data moving into the database. It lies cheats and steals and skips check constraints all in the name of speed. Great, I'm all for it. In sybase 12 I noticed that the api was exposed in the C client library, but not the java one. I've been looking but I haven't found anything that says they've yet implemented it in the sybase 15 java client library. Does anybody know if this is available or not in sybase 15? I disagree with your comments on Java using a BCP api.

What are the binary storage formats for sqflt8, sqlmoney and other native SQL data types?

こ雲淡風輕ζ 提交于 2019-12-05 03:46:39
According to the documentation, native (binary) data can be imported or exported with bcp formatted in the native SQL Server data formats. Examples of these are SQLFLT8, SQLFLT4, SQLMONEY or SQLNUMERIC. Does anyone know either what the data formats for the various types are, or where documentation specifying these formats might be found. For example, is a SQLFLT8 stored as an IEEE double precision number or in some other format? Edit: From the answers by kevchadders and Andrew I had a little epiphany did a little bit of googling for #define and typedef to see if I could find C header files