Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 29th, 2006, 04:56 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error exporting using bcp

Hi guys,

I hope you can help me, i am trying to export data using bcp to a directory on my website. I have verified that the directory exists etc, it creates the file i want, but doesnt populate it. Instead it says unable to open bcp host data-file.

My proc is:

ALTER PROCEDURE usp_ExportData
@ClientID INT
AS


/* GET CLIENT NAME */

DECLARE @Client_Name NVARCHAR(50)
SET @Client_Name = (SELECT ClientName FROM Clients WHERE ClientID = @ClientID)

/* DECLARE DIRECTORY NAME */

DECLARE @Dir_Name NVARCHAR(55)
SET @Dir_Name = @Client_Name+'data'

/* BEGIN EXPORT OF DATA */

DECLARE @C_String NVARCHAR(400)

SET @C_String = 'bcp "SELECT * FROM PSLFootball.dbo.Clubs WHERE ClientID = '+CAST(@ClientID AS NVARCHAR)+'" queryout "C:\inetpub\wwwroot\'+@Dir_Name+'\ClubsOut.txt " -Usa -PMYPASS -f,'
--PRINT @C_String
EXEC master..xp_cmdshell @C_String

I checked out a couple of other problems like this, but the solution is normally that the dir doesnt exist or its going across a server... can anyone help?






Similar Threads
Thread Thread Starter Forum Replies Last Post
BCP Error lisa30 SQL Server 2000 5 October 11th, 2007 07:06 PM
bcp error SpringSummer SQL Server 2005 1 July 12th, 2007 02:18 AM
BCP Error while importing data from a textfile happygv SQL Server 2000 5 October 6th, 2006 02:07 AM
exporting error Bhavin Crystal Reports 0 December 27th, 2004 11:44 AM
BCP error while importing data from a text file happygv SQL Server ASP 1 December 15th, 2003 09:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.