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?
|