bcp

Getting a buildable Boost extract with bcp

梦想与她 提交于 2019-12-03 03:55:57
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)? 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: boost-build /path/to/boost/tools/build/v2 ; where /path/to/boost needs to be substituted appropriately.

SQL Server BCP Bulk insert Pipe delimited with text qualifier format file

有些话、适合烂在心里 提交于 2019-12-02 20:17:50
问题 I have a csv file which is vertical pipe delimited with every column also with a text qualifier of ". I have been trying for ages to try and get the BCP format file to work, but no luck. I have the following staging table: [ID] [VARCHAR](100) NULL, [SUB_ID] [NUMERIC](18, 0) NULL, [CODE1] [VARCHAR](20) NULL, [CODE2] [NUMERIC](18, 0) NULL, [DATE] [DATE] NULL Data in csv: "ID"|"SUB_ID"|"CODE1"|"CODE2"|"DATE" "HAJHD87SADAD9A87SD9ADAS978DAA89D09AS"|"7510"|"N04FY-1"|"359420013"|"08/08/2018" Format

SQL Server 将数据导出为XML和Json

╄→гoц情女王★ 提交于 2019-12-02 17:58:54
有时候需要一次性将SQL Server中的数据导出给其他部门的也许进行关联或分析,这种需求对于SSIS来说当然是非常简单,但很多时候仅仅需要一次性导出这些数据而建立一个SSIS包就显得小题大做,而SQL Server的导入导出工具其中BUG还是蛮多的,最简单的办法是BCP。 数据导出为XML 在SQL Server 2005之后提供了一个for xml子句在关系数据库中原生支持XML。通过该命令可以将二维关系结果集转换为XML,通过BCP就可以将数据存为XML了。 例如下面的数据: 我们可以通过如下BCP命令(注意不能有回车)将其导出为XML文件,并保存: BCP "SELECT TOP 30 [bom_no],[LEVEL] FROM [sqladmin].[dbo].[bom] FOR XML path,TYPE, ELEMENTS ,ROOT('RegionSales')" QUERYOUT "d:\temp\test.XML" -c -t -T -S localhost 执行完成后查看Test.XML文件,如下图所示。可以看到文件格式非常清晰,很容易就可以导入到其他系统了。 数据导出为JSON 如果希望将SQL Server中数据导出为Json,虽然这种操作在应用程序里已经有非常成熟的方法,但SQL Server其实并没有原生支持这种方式(小道消息,下个版本会支持)

Unexpected EOF encountered in BCP data-file

此生再无相见时 提交于 2019-12-02 17:43:32
问题 I was trying copy data from a table to another table in another database using bcp. First a format file was created using !! bcp dbName1.dbo.tableName1 format nul -S serverName1 -T -f D:\tableName1_fmt.txt -n Then the data file was created using !! bcp dbName1.dbo.tableName1 out D:\tableName1.txt -S serverName1 -T -c Now I tried to import the data-file to another table in another database present in another server using the format file !! bcp dbName2.dbo.tableName2 in D:\tableName1.txt -f D:

Sybase ASE学习笔记

我的未来我决定 提交于 2019-12-02 15:58:53
通过这两天的学习,由于之前完全没有接触过sybase,发现sybase跟oracle或者SQL server都有比较大的差别,一是需要配置运行sybase的环境,二是sybase采用的是Transaction-SQL。三是,其数据库管理开始时让我很不习惯。 在接触别人安装了的sybase(linux 64bit-ase15.7)时,我发现sybase老是连不上,通过showserver命令来查看,shell却说没此命令,接着进入其安装 SYBASE_HOME/ASE-15_0/install/检查了,showserver没有问题,但启动./startServer.sh时,发现错误 了,出现了can execute file RUN_SYBASE。此刻我发现了我与本目录的RUN_*****不同,虽然意识到不同,但我只是mark下它而没有进行进一步思考。通过上网搜索资 料,如果sybase是安装成功,那么应该就是环境问题了。所以我调用./SYBASE.sh(我以为起码当前的环境就配好了),于是我就调用isql -Usa -S服务名、isql -Usa -S192.168.*.*和isql -Usa -S192.168.*.*:5000 以及它们各种变形,其间还需用注意得在SYBASE_HOME/OCS-15_0/bin目录下(即存在isql.sh脚本文件的目录下),这里花了我不

Writing data to text file using BCP prompts for file storage type

帅比萌擦擦* 提交于 2019-12-02 07:58:35
I'm copying data from SQL to text file using bcp tool with following command: bcp.exe "exec <StoredProcedure>" queryout "temp.txt" -T -r\n -c This command runs as expected on test environment and creates/updates required file without additional prompts. But when it's run in client's environment, bcp additionally prompts for field length, prefix and field terminator- so when command is run from SQL Agent job, it get's stuck in infinite wait. Any ideas why is this happening? Based on bcp documentation , when -c parameter is used - it shouldn't prompt for type, etc. and should use char as the

Output XML Files with encoding UTF-8 using SQL Server

蹲街弑〆低调 提交于 2019-12-02 02:49:07
I have a query that generates XML files and loads them to FTP with <?xml version="1.0"?> . I need to switch encoding to UTF-8 as follows: <?xml version="1.0" encoding="utf-8"?> I can do it manually in the text editor. But cannot do it in SQL Server. I also read this article but that did not contribute in finding solution for the issue. https://docs.microsoft.com/en-us/sql/relational-databases/xml/create-instances-of-xml-data My code: USE [Audit_DBA] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- to call the procedure use the code below but assign your own path: -- EXEC [Audit_DBA].[dbo

Run a shell command with arguments from powershell script

梦想与她 提交于 2019-12-02 00:50:07
问题 I need to extract and save a some tables from a remote SQL database using bcp. I would like to write a powershell script to invoke bcp for each table and save the data. So far I have this script that creates the necessary args for bcp. However I can not figure out how to pass the args to bcp. Every time I run the script it just shows the bcp help instead. This must be something really easy that I am not getting. #commands bcp database.dbo.tablename out c:\temp\users.txt -N -t, -U uname -P pwd

Run a shell command with arguments from powershell script

寵の児 提交于 2019-12-01 20:24:13
I need to extract and save a some tables from a remote SQL database using bcp. I would like to write a powershell script to invoke bcp for each table and save the data. So far I have this script that creates the necessary args for bcp. However I can not figure out how to pass the args to bcp. Every time I run the script it just shows the bcp help instead. This must be something really easy that I am not getting. #commands bcp database.dbo.tablename out c:\temp\users.txt -N -t, -U uname -P pwd -S <servername> $bcp_path = "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\bcp.exe" $serverinfo

Getting bcp.exe to escape terminators

大兔子大兔子 提交于 2019-12-01 15:43:50
I need to export some data using SQL Server 2000's BCP utility. Sometimes my data contains characters, such as \t and \n, that I need to use as column and row terminators. How do I get BCP to escape characters it's using as terminators as it outputs the data, so that I can actually import the data in another program? For example, one of my columns is text data, and includes tabs and newlines. BCP just exports them as-is, and the program I'm trying to import them with gets confused because the data ends in the middle of a line and/or a line contains extra columns for no apparent reason. This