sql server - SQL bcp The semaphore timeout period has expired -


i'm making bulk copy onto file of select in database.

declare @cmd varchar(1000) declare @sql varchar(8000)  set @cmd='"select * [mydb].[dbo].mytable"'  select @sql = 'bcp '+@cmd+' queryout c:\myfile.txt -c -t -t -s myserver -u user -p password'; exec xp_cmdshell @sql; 

if change parameters , execute same command on database test on machine works, on database server error:

msg 121, level 20, state 0, line 0 transport-level error has occurred when receiving results server. (provider: tcp provider, error: 0 - semaphore timeout period has expired.) 

i check server name, user, password, table name , correct, cannot understand i'm doing wrong. can me issue? thanks

increase timeout seconds in connection string.

private static void opensqlconnection() {    string connectionstring = getconnectionstring();    using(sqlconnection connection = new sqlconnection(connectionstring)) {      connection.open();      console.writeline("state: {0}", connection.state);      console.writeline("connectiontimeout: {0}",        connection.connectiontimeout);    }  }    static private string getconnectionstring() {    // avoid storing connection string in code,      // can retrieve configuration file, using      // system.configuration.configurationsettings.appsettings property      return "data source=(local);initial catalog=adventureworks;" + "integrated security=sspi;connection timeout=30";  }


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -