Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 BCP w/UNC path problem

Author  Topic 

fralo
Posting Yak Master

161 Posts

Posted - 2011-01-05 : 09:59:09
Hi all,

I'm trying to output a file from one server to another using BCP.

It fails, I think, because the path contains space in 'Program Files'. Does anyone know how to resolve this?

select @sqloutput = 'bcp test.dbo.test_con out "\\10.10.10.10\c$\Program Files\concentrasftp\concentra.txt" -c -t "|" -T -S'

Thanks for your help.

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-01-05 : 10:09:17
To verify if this is the problem you can go to the server and do a "dir /x" at the cmd prompt. It will give you the 8-letter name of the Program Files folder. Replacing what you have with this should do the trick (given that your assumptions are correct):

select @sqloutput = 'bcp test.dbo.test_con out "\\10.10.10.10\c$\PROGRA~1\concentrasftp\concentra.txt" -c -t "|" -T -S'

If that doesn't work, then it's most likely a permission issue. Make sure that the user running sql server has access to the unc-folder specified.

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page

fralo
Posting Yak Master

161 Posts

Posted - 2011-01-05 : 10:43:14
I modified the path as 'PROGRAM~1' and it doesn't work, nor do I think it is a permissions issue. When running in management studio, the output upon execution says 'User name not provided, either use -U to provide the user name or use -T for Trusted Connection.

I'm not sure of the syntax for -U and I already have -T in my code.
Go to Top of Page
   

- Advertisement -