﻿<?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 7,2000 / T-SQL  / BCP error -Unable to open BCP host data-file / 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>Thu, 20 Jun 2013 04:06:17 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Hi everyone,I have this error output in SSMS for the following queryexec Master..xp_cmdshell 'bcp "select blobdata from SynDocs.dbo.BLOBDATA where blobid = 2" queryout "c:\filename2.img" -S ROK-W7STHONUK-7 -T'The output is 2 rowsNULLEnter the file storage type of field blobdata [image]: when i run the same query thru cmd prompt, the result is SQLState = S1000, NativeError = 0Error = [Microsoft][SQL Native Client]Unable to open BCP host data-file.any of you help me with this please.</description><pubDate>Thu, 21 Mar 2013 11:07:02 GMT</pubDate><dc:creator>tsandeep1407</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Thank you. It was the wrong directory.</description><pubDate>Mon, 07 Jan 2013 00:50:09 GMT</pubDate><dc:creator>ansafmmm</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Thanks Sergiy for the reply..Sql Server resides in the machine where im executing xp_cmdshell in that case my local machine and server are the same..all other commands works fine with xp_cmdshell.. only bcp throws an error ..So i don't think that is the problem. Any way I have tried Wat  u have toldHere are the results and they are Identical-- Through xp_cmdshell Volume in drive C has no label. Volume Serial Number is 402B-0039NULL Directory of c:\NULL06/15/2010  10:54 AM            17,408 1.xls04/14/2010  05:23 PM    &amp;lt;DIR&amp;gt;          80613812935150ba7204/14/2010  03:27 PM                 0 AUTOEXEC.BAT05/12/2010  04:55 PM             1,652 bar.emf05/07/2010  06:14 PM    &amp;lt;DIR&amp;gt;          bujji05/19/2010  12:48 PM    &amp;lt;DIR&amp;gt;          BUJJI_RD04/14/2010  03:27 PM                 0 CONFIG.SYS06/14/2010  10:44 AM    &amp;lt;DIR&amp;gt;          db06/07/2010  02:39 PM    &amp;lt;DIR&amp;gt;          Documents and Settings02/19/2010  03:55 PM         8,327,264 Firefox Setup 3.6.exe06/03/2010  10:27 AM    &amp;lt;DIR&amp;gt;          Inetpub04/14/2010  05:14 PM               244 Install.log04/14/2010  05:10 PM    &amp;lt;DIR&amp;gt;          Intel06/17/2010  06:21 PM    &amp;lt;DIR&amp;gt;          Lijo06/18/2010  10:40 AM                12 lijo.txt04/19/2010  01:25 PM    &amp;lt;DIR&amp;gt;          MSDE_Database06/02/2010  06:22 PM    &amp;lt;DIR&amp;gt;          MSVisualStudio6.0006/09/2010  11:48 AM    &amp;lt;DIR&amp;gt;          oboutSuite06/18/2010  06:12 PM    &amp;lt;DIR&amp;gt;          Official06/18/2010  04:12 PM    &amp;lt;DIR&amp;gt;          Program Files04/14/2010  05:12 PM             1,769 RHDSetup.log06/19/2010  09:27 AM               970 service.log05/05/2010  06:18 PM    &amp;lt;DIR&amp;gt;          Softwares05/25/2010  03:05 PM    &amp;lt;DIR&amp;gt;          Stanley05/25/2010  03:07 PM       160,178,714 Stanley.zip04/02/2010  02:30 PM        15,944,192 TA.bak06/14/2010  10:38 AM            28,521 test.jpg06/15/2010  10:54 AM            17,408 Test.xls06/15/2010  10:49 AM             8,281 Test.xlsx04/23/2010  11:39 AM    &amp;lt;DIR&amp;gt;          SAmple06/18/2010  10:31 AM    &amp;lt;DIR&amp;gt;          WINDOWS06/17/2010  06:14 PM    &amp;lt;DIR&amp;gt;          WindowsApplication105/18/2010  01:08 PM    &amp;lt;DIR&amp;gt;          working folder              14 File(s)    184,526,435 bytes              19 Dir(s)  81,251,590,144 bytes free-- Through Cmd prompt Volume in drive C has no label. Volume Serial Number is 402B-0039 Directory of c:\06/15/2010  10:54 AM            17,408 1.xls04/14/2010  05:23 PM    &amp;lt;DIR&amp;gt;          80613812935150ba7204/14/2010  03:27 PM                 0 AUTOEXEC.BAT05/12/2010  04:55 PM             1,652 bar.emf05/07/2010  06:14 PM    &amp;lt;DIR&amp;gt;          bujji05/19/2010  12:48 PM    &amp;lt;DIR&amp;gt;          BUJJI_RD04/14/2010  03:27 PM                 0 CONFIG.SYS06/14/2010  10:44 AM    &amp;lt;DIR&amp;gt;          db06/07/2010  02:39 PM    &amp;lt;DIR&amp;gt;          Documents and Settings02/19/2010  03:55 PM         8,327,264 Firefox Setup 3.6.exe06/03/2010  10:27 AM    &amp;lt;DIR&amp;gt;          Inetpub04/14/2010  05:14 PM               244 Install.log04/14/2010  05:10 PM    &amp;lt;DIR&amp;gt;          Intel06/17/2010  06:21 PM    &amp;lt;DIR&amp;gt;          Lijo06/18/2010  10:40 AM                12 lijo.txt04/19/2010  01:25 PM    &amp;lt;DIR&amp;gt;          MSDE_Database06/02/2010  06:22 PM    &amp;lt;DIR&amp;gt;          MSVisualStudio6.0006/09/2010  11:48 AM    &amp;lt;DIR&amp;gt;          oboutSuite06/18/2010  06:12 PM    &amp;lt;DIR&amp;gt;          Official06/18/2010  04:12 PM    &amp;lt;DIR&amp;gt;          Program Files04/14/2010  05:12 PM             1,769 RHDSetup.log06/19/2010  09:22 AM               145 service.log05/05/2010  06:18 PM    &amp;lt;DIR&amp;gt;          Softwares05/25/2010  03:05 PM    &amp;lt;DIR&amp;gt;          Stanley05/25/2010  03:07 PM       160,178,714 Stanley.zip04/02/2010  02:30 PM        15,944,192 TA.bak06/14/2010  10:38 AM            28,521 test.jpg06/15/2010  10:54 AM            17,408 Test.xls06/15/2010  10:49 AM             8,281 Test.xlsx04/23/2010  11:39 AM    &amp;lt;DIR&amp;gt;          SAmple06/18/2010  10:31 AM    &amp;lt;DIR&amp;gt;          WINDOWS06/17/2010  06:14 PM    &amp;lt;DIR&amp;gt;          WindowsApplication105/18/2010  01:08 PM    &amp;lt;DIR&amp;gt;          working folder              14 File(s)    184,525,610 bytes              19 Dir(s)  81,251,434,496 bytes free--Regards Alban Lijo</description><pubDate>Fri, 18 Jun 2010 22:05:13 GMT</pubDate><dc:creator>Alban Lijo</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>When you run bcp on your local machine C:\ is your local drive.When you run bcp on the server C:\ is a local drive on he server.Compare:"dir C:\" from command prompt and exec master.dbo.xp_cmdshell 'dir c:\'</description><pubDate>Fri, 18 Jun 2010 17:06:09 GMT</pubDate><dc:creator>Sergiy</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Hi,I am trying to execute [b]exec Master..xp_cmdshell 'bcp "Select _Id_ from PM.dbo._TST_" queryout "C:\_ID_Test.txt" -c -U SA -P AA112233** -S MYLAP\SQLEXPRESS'[/b]Gives an Output[b]SQLState = S1000, NativeError = 0Error = [Microsoft][SQL Native Client]Unable to open BCP host data-fileNULL[/b][b]The Same Statement when I execute from cmd prompt [/b][b] bcp "Select _Id_ from PM.dbo._TST_" queryout "C:\_ID_Test.txt" -c -U SA -P AA112233** -S MYLAP\SQLEXPRESS[/b]Gives the Output Starting copy...[b]4 rows copied.Network packet size (bytes): 4096Clock Time (ms.) Total     : 94     Average : (42.55 rows per sec.)[/b]Where am I going wrong...-- Regards Alban Lijo</description><pubDate>Thu, 17 Jun 2010 23:12:38 GMT</pubDate><dc:creator>Alban Lijo</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Thanks a lot. That's what i was confused with.</description><pubDate>Sat, 16 Jan 2010 23:21:53 GMT</pubDate><dc:creator>funooni</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>It's on [b]server's[/b] C: drive inside temp folder.</description><pubDate>Sat, 16 Jan 2010 14:47:38 GMT</pubDate><dc:creator>Sergiy</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>GentlemenI am using BCP in a stored procedure to create an excel XML fileeverything goes fine and i get the following output when the BCP command is executed NULLStarting copy...NULL4 rows copied.Network packet size (bytes): 4096Clock Time (ms.) Total     : 1      Average : (4000.00 rows per sec.)NULLbut the problem is i cannot find the file that is created/or should have been createdSET @testString2 = 'BCP "SELECT MAN_Content FROM [DBNAME].[dbo].[TABLENAME] ORDER BY id" queryout "C:\Temp\ECC_MSXLSBySQLServer2005.xls" -C RAW -S SERVERNAME -T -w'Exec Master..xp_cmdshell @testString2 I cant find the file , which i assume should be in my C drive inside temp folder.any help shall be highly appreciated.RegardsZeeshan</description><pubDate>Sat, 16 Jan 2010 05:38:45 GMT</pubDate><dc:creator>funooni</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;P&gt;Yes, it does. That's what the -S&amp;lt;servername&amp;gt; parameter says...&lt;/P&gt;&lt;P&gt;/Kenneth&lt;/P&gt;</description><pubDate>Mon, 14 May 2007 01:43:00 GMT</pubDate><dc:creator>Kenneth Wilhelmsson</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;P&gt;specify the name of server &lt;/P&gt;&lt;P&gt;servername.dbo.T1&lt;/P&gt;&lt;P&gt;otherwise bcp (executed on cmd line) does not where is T1&lt;/P&gt;</description><pubDate>Fri, 11 May 2007 07:38:00 GMT</pubDate><dc:creator>fasttrack</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;P&gt;This can also be caused by the account BCP is using, since you are using SQL Login, this will be either:&lt;/P&gt;&lt;P&gt;Your account if excuted from Command line&lt;/P&gt;&lt;P&gt;The SQL Server service account if using xp_cmdshell&lt;/P&gt;&lt;P&gt;SQL Server Agent service account, if it is being executed in a CmdExec or T-SQL with xp_cmdshell step. The account can be configured within the Job as well.&lt;/P&gt;&lt;P&gt;The BCP account needs access to the file, for UNC this includes the share. &lt;/P&gt;&lt;P&gt;A trick for Local Service is to grant the SQL Server Computer account these network permissions.&lt;/P&gt;&lt;P&gt;For UNC with the service using a Domain account, the permissions should be verified by logging in as the service account, browse to the file in question, and run BCP from the cmd line.&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description><pubDate>Fri, 11 May 2007 00:51:00 GMT</pubDate><dc:creator>David A. Long</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>One more point. The table identified as T1 is not qualified. Depending on the user ID supplied this may change what database the table will be looked for in. By default it will be the master database. My suggestion is to qualify the table name on your bcp statement in order to eliminate any potential confusion or errors.</description><pubDate>Thu, 10 May 2007 07:03:00 GMT</pubDate><dc:creator>rudy - Doctor "X"</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;P&gt;bcp T1 out D:\Archive -S &amp;lt;Server_Name&amp;gt; -U &amp;lt;username&amp;gt; -P &amp;lt;pwd&amp;gt; -b 10000 -c -t |;&lt;/P&gt;&lt;P&gt;.. is this the actual commandline? It looks a bit fishy in two places.Unless you want your file to be named 'Archive', you haven't supplied a filename, only the directory 'D:\Archive'&lt;/P&gt;&lt;P&gt;..is the delimiter a pipe + semicolon?In any case, a pipe on a commandline acts as a redirection operator, so try enlosing it in quotes.bcp T1 out D:\Archive -S &amp;lt;Server_Name&amp;gt; -U &amp;lt;username&amp;gt; -P &amp;lt;pwd&amp;gt; -b 10000 -c -t &lt;STRONG&gt;&lt;FONT color=#ff1111&gt;"&lt;/FONT&gt;&lt;/STRONG&gt;|;&lt;FONT color=#ff1111&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;(if the semicolon is just some sort of 'statement-end', just remove it-)&lt;/P&gt;&lt;P&gt;/Kenneth&lt;/P&gt;</description><pubDate>Thu, 10 May 2007 02:24:00 GMT</pubDate><dc:creator>Kenneth Wilhelmsson</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for quick reply, below is the result&lt;/P&gt;&lt;P&gt;C    9308&lt;/P&gt;&lt;P&gt;D    31946&lt;/P&gt;&lt;P&gt; Pls let me know if you need any other information&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sankar&lt;/P&gt;</description><pubDate>Wed, 09 May 2007 00:24:00 GMT</pubDate><dc:creator>Sankar-403950</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Runexec master..xp_fixeddrivesWhat is the result?</description><pubDate>Tue, 08 May 2007 23:48:00 GMT</pubDate><dc:creator>Sergiy</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am getting the same problem in the following scenario&lt;/P&gt;&lt;P&gt;I have created one table "T1" using filegroup "A" contains only data file "A_1.ndf" with size 100M and disaled autogrowth. This file group size reaches 100M means its 100% full. Now I am trying to archive this "T1" table data using bcp command as follows:&lt;/P&gt;&lt;P&gt;bcp T1 out D:\Archive -S &amp;lt;Server_Name&amp;gt; -U &amp;lt;username&amp;gt; -P &amp;lt;pwd&amp;gt; -b 10000 -c -t |;&lt;/P&gt;&lt;P&gt;it throws the below error:&lt;/P&gt;&lt;P&gt;"SQLState = S1000, NativeError = 0Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file"&lt;/P&gt;&lt;P&gt;While executing bcp command, does it requires some space in filegroup "A"?&lt;/P&gt;&lt;P&gt;Can any body help how to resolve this?&lt;/P&gt;&lt;P&gt;--Thanks Sankar&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Tue, 08 May 2007 23:26:00 GMT</pubDate><dc:creator>Sankar-403950</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Check permissions for the account running SQL Server Agent.It could be not the same as for SQL Server.</description><pubDate>Fri, 27 Apr 2007 17:01:00 GMT</pubDate><dc:creator>Sergiy</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>the actual error never made it into the post.</description><pubDate>Fri, 27 Apr 2007 09:14:00 GMT</pubDate><dc:creator>rudy - Doctor "X"</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;P&gt;i got this error while running a bcp command from the xp_cmdshell&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;if i run the bcp separately on the dos prompt, it runs fine&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Anyone knows the info to correct this problem?  Thanks&lt;/P&gt;</description><pubDate>Fri, 27 Apr 2007 08:42:00 GMT</pubDate><dc:creator>Patrick Nguyen</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Thanks All for you reply. This issue was resloved. i was trying to BCP out on a logical drive which  was mapped correctly. but then my network admin told me that sql server could not access the network drive due to some permission issues.</description><pubDate>Wed, 16 Nov 2005 13:06:00 GMT</pubDate><dc:creator>Sapna Ranka</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>Also, if there are spaces in the name don't forget the double quotes ... like "C:\Program Files" ... If you're executing from xp_cmdshell you might try a DIR command in xp_cmdshel to check things out security-wise. I'd also stay away from mapped drives since SQL Server is only made aware of them each time the service is started - UNCs are the way to go.</description><pubDate>Wed, 16 Nov 2005 13:00:00 GMT</pubDate><dc:creator>rudy - Doctor "X"</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;P&gt;Whenever I get this message, it's because of one of three things:&lt;/P&gt;&lt;P&gt;1) The path/filename is incorrect (check your typing / spelling)&lt;/P&gt;&lt;P&gt;2) The file does not exist. (make sure the file is where you expect it to be)&lt;/P&gt;&lt;P&gt;3) The file is already open by some other app. (close the other app to release the file)&lt;/P&gt;&lt;P&gt;For 1) and 2) - remember that &lt;EM&gt;paths are relative to where bcp is executing.&lt;/EM&gt; Make sure that bcp.exe can access the file/path from it's context.&lt;/P&gt;&lt;P&gt;/Kenneth&lt;/P&gt;</description><pubDate>Wed, 16 Nov 2005 06:12:00 GMT</pubDate><dc:creator>Kenneth Wilhelmsson</dc:creator></item><item><title>RE: BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>You can map the network drive first and then use that mapped drive to do it.</description><pubDate>Tue, 15 Nov 2005 11:06:00 GMT</pubDate><dc:creator>rsharma</dc:creator></item><item><title>BCP error -Unable to open BCP host data-file</title><link>http://www.sqlservercentral.com/Forums/Topic237238-8-1.aspx</link><description>&lt;FONT size=2&gt;&lt;P&gt;SQLState = S1000, NativeError = 0&lt;/P&gt;&lt;P&gt;Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file&lt;/P&gt;&lt;P&gt;NULL&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;I am getitng the above error when i am executinf BCP. The file location is not on the local machine. it is a network drive. Please help !&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Tue, 15 Nov 2005 09:19:00 GMT</pubDate><dc:creator>Sapna Ranka</dc:creator></item></channel></rss>