Reputation: 83
I'm struggling with bcp
. If I run the following SQL
exec xp_cmdshell 'bcp "select a.displayname, a.samaccountname, a.mail, a.title, a.givenname, a.sn from web_repository.dbo.activedirectory a ORDER BY displayname" queryout "C:\phonegapdownload\test.dat" -N -S IISSERVER -T '
it works fine, however if I run this
exec xp_cmdshell 'bcp "EXEC SelectAllFromADNoJoin" queryout "C:\phonegapdownload\test.dat" -N -S IISSERVER -T '
which has the exact same SQL in it, it throws an error
SQLState = 37000, NativeError = 2812
// not sure where I got this error from
It's running on SQL Server 2008 R2
Can anyone help?
I have checked that SQL Server allows remote connections and that tcpip is enabled
SQLState = 08001, NativeError = 53
Error = [Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could not open a connection to SQL Server [53].
SQLState = 08001, NativeError = 53
Error = [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
SQLState = S1T00, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Login timeout expired
Upvotes: 0
Views: 2735
Reputation: 28809
Posting the full text of the error message would help. Error 2812 is "Could not find stored procedure". You will want to specify the -d
option to specify your database, or use a quoted name (MyDB.dbo.SelectAllFromADNoJoin
).
Upvotes: 1