bcp

How to backup and restore sybase database tables using command line [closed]

十年热恋 提交于 2019-11-29 18:02:35
How can I backup my sybase tables and restore using command line? please help me with the command using bcp I have tried using sybase central GUI Thanks. Michael Gardner Since you didn't specify whether you are running on Windows or Unix I'll try to cover both. Unix bcp is located in $SYBASE/$SYBASE_OCS/bin/ Windows bcp is located in %SYBASE%\%SYBASE_OCS%\bin Export bcp DB_NAME..TABLE_NAME out TABLE_NAME.bcp -Sservername -Uusername -Ppassword -[c or n] Choose either -c or -n depending if you want the file to be human readable or not. I recommend using -n unless you have a compelling need to

Unable to open BCP host data-file

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 11:22:36
问题 Below is an example of the BCP Statement. I'm not accustomed to using BCP so your help and candor is greatly appreciated I am using it with a format file as well. If I execute from CMD prompt it works fine but from SQL I get the error. The BCP statement is all on one line and the SQL Server Agent is running as Local System. The SQL server, and script are on the same system. I ran exec master..xp_fixeddrives C,45589 E,423686 I've tried output to C and E with the same result EXEC xp_cmdshell

Bulk Load Files into SQL Azure?

两盒软妹~` 提交于 2019-11-29 05:50:06
I have an ASP.NET app that takes multimegabyte file uploads, writes them to disk, and later MSSQL 2008 loads them with BCP. I would like to move the whole thing to Azure, but since there are no "files" for BCP, can anyone comment on how to get bulk data from an Azure app into SQL Azure? I did see http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx but am not sure if that applies. Thanks. BCP is one way to do it. This post explains it in three easy steps: Bulk insert with Azure SQL Loading data to SQL Azure the fast way You are on the right track. The Bulk Copy API

How to make Microsoft BCP export empty string instead of a NUL char?

雨燕双飞 提交于 2019-11-29 03:33:41
I was working trying to get this bcp tool to work in a particular way. The -c switch is supposed to export using chars, but for some reason there was a weird char showing in Notepad++ like if it was UNICODE or some other formatting. I wanted to get that char, which was an Empty string in the database, to export as an empty string into the text file. How do you do that? mimoralea Well, after looking around the web this is what I found. Thought to put it in SO so more people have access to it. http://www.techtalkz.com/microsoft-sql-server/147106-how-export-empty-strings-via-bcp.html But when I

bcp: Error = [Microsoft][SQL Server Native Client 10.0]String data, right truncation

别说谁变了你拦得住时间么 提交于 2019-11-29 01:45:39
I have recently encountered an error while working with bcp. Here is the error. SQLState = 22001, NativeError = 0 Error = [Microsoft][SQL Server Native Client 10.0]String data, right truncation I'm trying to unpack the data into a staging table which does not have any constraints and the datatypes are also fairly large when compared to the data. I have about 11 files from different tables being bcp'd and zipped out of which only one file when unpacking errors out. This is the command which I have been using succesfully. Very recently(when trying to make a copy of the current WH and settign up

Use bcp to import csv file to sql 2005 or 2008

风流意气都作罢 提交于 2019-11-28 22:03:00
I have a csv file and i need to import it to a table in sql 2005 or 2008. The column names and count in the csv are different from the table column names and count. The csv is splitted by a ';' . Example CSV FILEcontents: FirstName;LastName;Country;Age Roger;Mouthout;Belgium;55 SQL Person Table Columns: FName,LName,Country I'd create a temporary table, bulk insert the lot, select into the new table what you need and drop the temporary table. Something like CREATE TABLE dbo.TempImport ( FirstName varchar(255), LastName varchar(255), Country varchar(255), Age varchar(255) ) GO BULK INSERT dbo

how to specify row delimiter when using bcp with a format file

半世苍凉 提交于 2019-11-28 10:31:27
问题 I am using bcp utility to import data into Sybase database on Solaris system Since the bcp file is generated by another xml parsing script, I have no control on that to make it generate the fields in the order I want. And now the the order of fields in the bcp file is a little different with the order in the database table. I want to use a format file for bcp tool to control the order of fields loaded into the database, so I have the sample bcp file as below and constructed a format file

Export xml data using BCP Command in SQL Server

天涯浪子 提交于 2019-11-28 05:09:40
问题 I am trying to export datable data in xml format but,Problem is like i can able to create xml file but data is not get writing in to the file following is my code I am trying. DECLARE @cmd VARCHAR(2000); SET @cmd = 'bcp.exe "select * from emp FOR XML AUTO" queryout E:\rahul_1.xml -x -T'; EXEC xp_cmdshell @cmd ; And following is the output message I am getting after executing above code NULL Enter the file storage type of field XML_F52E2B61-18A1-11d1-B105-00805F49916B [ntext]: can any body

Exporting SQL Server Table to multiple part files

纵然是瞬间 提交于 2019-11-28 00:19:01
I need to export a fairly large SQL Server table ~100GB to a CSV file. But rather than the output be a single csv file, it should ideally be multiple files say 10 files each 10GB. I see BCP has a batch_size argument but this still writes all data to a single file? Are there other free utilities for doing what I require? Either where the size of file can be specified in bytes or number of rows? For bit of context this is so the data can be combined with other sources in a Hive/Hadoop platform, so if there are better ways of exporting the data I'm open for suggestions. I think you could use SQL

bcp: Error = [Microsoft][SQL Server Native Client 10.0]String data, right truncation

倾然丶 夕夏残阳落幕 提交于 2019-11-27 21:21:02
问题 I have recently encountered an error while working with bcp. Here is the error. SQLState = 22001, NativeError = 0 Error = [Microsoft][SQL Server Native Client 10.0]String data, right truncation I'm trying to unpack the data into a staging table which does not have any constraints and the datatypes are also fairly large when compared to the data. I have about 11 files from different tables being bcp'd and zipped out of which only one file when unpacking errors out. This is the command which I