﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / bcp Errors / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 16:51:27 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>Thank Lowell! After an entire day of troubleshooting, your answer finally helped us solve the issue! :-)</description><pubDate>Wed, 13 Feb 2013 15:42:00 GMT</pubDate><dc:creator>kmclin</dc:creator></item><item><title>RE: bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>Thanks Lowell, your answer has helped me too.</description><pubDate>Fri, 20 Apr 2012 03:28:45 GMT</pubDate><dc:creator>John Olynn-373146</dc:creator></item><item><title>RE: bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>Got it. Someone had changed the Server.  It is a dev box. the Production box is fine. All is well.Thank You Lowell!</description><pubDate>Tue, 30 Aug 2011 13:11:53 GMT</pubDate><dc:creator>Charlie-551146</dc:creator></item><item><title>RE: bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>[quote][b]Charlie-551146 (8/30/2011)[/b][hr]No Sybase installed.[/quote]Charlie don't hate me, i'm just the messenger, but that is defintiely the context menu from SyBase's bcp /?[url]http://manuals.sybase.com/onlinebooks/group-as/asg1250e/util/@Generic__BookTextView/10086;pt=10086[/url]try changing the path to bcp to explicitly go to teh microsoft folder, or edit your PATH environments to exclude the Sybase directory(on the server running xp_cmdshell....not your local box, unless they are the same machine).</description><pubDate>Tue, 30 Aug 2011 12:34:29 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>No Sybase installed.</description><pubDate>Tue, 30 Aug 2011 12:17:55 GMT</pubDate><dc:creator>Charlie-551146</dc:creator></item><item><title>RE: bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>[quote][:slice_number[/quote]THAT makes me thing you are calling the SyBase bcp.exe and Not the SQL Server's version. SQl doesn't have a slice.do you have SyBase client tools installed?if you change the command to" C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\bcp.exe, does it work then?</description><pubDate>Tue, 30 Aug 2011 10:56:34 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>Thanks Lowell,I changed the query to read like this:DECLARE @Filename VARCHAR(100)DECLARE @SQL VARCHAR(4000)SET @Filename = 'C:\Event.xml'SET @SQL = 'EXEC AllEvents.dbo.USP_EventXML'SET @SQL= 'bcp "' + @SQL +'" queryout ' + @filename + ' -w  -r "" -Uce672992 -PNot_Real -SSITW2K3SPA03 ' PRINT @SQLEXEC Master..xp_CmdShell @SQLNow I'm getting a syntax error in queryout  Copy direction must be either 'in' or 'out'.Syntax Error in 'queryout'.usage: bcp [[database_name.]owner.]table_name[:slice_number] {in | out} datafile [-m maxerrors] [-f formatfile] [-e errfile] [-F firstrow] [-L lastrow] [-b batchsize] [-n] [-c] [-t field_terminator] [-r row_terminator] [-U username] [-P password] [-I interfaces_file] [-S server] [-a display_charset] [-q datafile_charset] [-z language] [-v] [-A packet size] [-J client character set]  [-T text or image size] [-E] [-g id_start_value] [-N] [-X] [-M LabelName LabelValue] [-labeled] [-K keytab_file] [-R remote_server_principal] [-V [security_options]] [-Z security_mechanism] [-Q]NULL</description><pubDate>Tue, 30 Aug 2011 10:42:27 GMT</pubDate><dc:creator>Charlie-551146</dc:creator></item><item><title>RE: bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>Charlie I only see two things.i think the call to the procedure has to be fully qualified, i always put the servername.schemaname, but that might not be an issue.the other thing i see that doesn't match my examples, is where i expect the -r or -t row and field terminators to be in [b]double [/b]quotes...yours doesn't look like it did (i know the forum strips slahs-n unless you htmlize it)...but i'd expect the dbl quotes.i just tested the example below, and it works fine.[code]DECLARE @sql varchar(2000),@filename varchar(200)SET @sql      = 'EXEC Sandbox.dbo.sp_find ''act'' 'set @filename = 'c:\data\myfile.xml '--put it all together--flags -w wide format--t custom field terminator--r custom row terminator--U username--Ppassword--S serverSET @sql = 'bcp "' + @sql + '" queryout "' + @filename + '" -w -t"|" -r"&amp;#92;&amp;#110;"  -Ulowell -PNotTheRealPassword -SDEV223'EXEC Master..xp_CmdShell @SQL[/code]</description><pubDate>Tue, 30 Aug 2011 09:52:44 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>bcp Errors</title><link>http://www.sqlservercentral.com/Forums/Topic1167602-338-1.aspx</link><description>I am trying to run the following statement, but get errors.  Any help would be appreciated.DECLARE @SQL VARCHAR(4000)SET @SQL= 'bcp "exec USP_EventXML" queryout c:\myfile.xml -w -r -t -S &amp;lt;servername removed&amp;gt; -U &amp;lt;loginid removed&amp;gt; -P &amp;lt;password removed&amp;gt;' EXEC Master..xp_CmdShell @SQLThis is supposed to write an XML file of the table contents to c:\myfile.xml Errors are:Copy direction must be either 'in' or 'out'.Syntax Error in 'queryout'.usage: bcp [[database_name.]owner.]table_name[:slice_number] {in | out} datafile [-m maxerrors] [-f formatfile] [-e errfile] [-F firstrow] [-L lastrow] [-b batchsize] [-n] [-c] [-t field_terminator] [-r row_terminator] [-U username] [-P password] [-I interfaces_file] [-S server] [-a display_charset] [-q datafile_charset] [-z language] [-v] [-A packet size] [-J client character set]  [-T text or image size] [-E] [-g id_start_value] [-N] [-X] [-M LabelName LabelValue] [-labeled] [-K keytab_file] [-R remote_server_principal] [-V [security_options]] [-Z security_mechanism] [-Q]NULLThank You,Charlie</description><pubDate>Tue, 30 Aug 2011 09:05:14 GMT</pubDate><dc:creator>Charlie-551146</dc:creator></item></channel></rss>