I'm trying to export to a Windows Named Pipe from the SQL Server bcp utility.
I'm creating my pipe on Windows using VB.Net as follows:
Dim ps As New PipeSecurity()
ps.AddAccessRule(New PipeAccessRule("Users", PipeAccessRights.FullControl, System.Security.AccessControl.AccessControlType.Allow))
Dim pipeServer As New NamedPipeServerStream("testpipe", PipeDirection.InOut, 4, PipeTransmissionMode.Byte, PipeOptions.None, 131072, 131072, ps)
pipeServer.WaitForConnection()
I'm running a Teradata FastLoad job to start reading from the pipe. I get the message "Starting to send to RDBMS with record 1". This tells me the utility has connected to the pipe and is waiting to be fed records. IsConnected on the pipe also returns true.
When I run bcp however I get this error:
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC Driver 11 for SQL Server]Unable to open BCP host data-file
Here is my bcp commmand line...
"bcp" [SQL_Class].[dbo].[Customer_table] out "\\.\pipe\testpipe" -S 12.12.122.12,12121 -U sa -e "err.txt" -o "out.txt" -w
Any suggestions on what I might be doing wrong? Is this even supported (I've seen different answers online)? Should I be using something else?
Also, when not using bcp if I just try to run this command...
type data.txt > \.\pipe\testpipe
I get an error saying all instances are busy so this is pointing to the pipe and not bcp.
Any help would be appreciated. Thank you.