First of all, Thanks for the tool. I'm finding it very useful for automated builds and rollout scripts. However, I have some scripts that migrate data occasionally. I have run into a scenario where I have a data migration that takes almost 45 minutes. SqlRunner is not setting the commandTimeout before it runs the script, and therefore times out after 30 seconds.
I have modified:
public void Execute( string sqlString )
{
SqlCommand cmd = new SqlCommand( sqlString, _connection );
cmd.ExecuteNonQuery();
}
to:
public void Execute( string sqlString )
{
SqlCommand cmd = new SqlCommand( sqlString, _connection );
cmd.CommandTimeout=0;
cmd.ExecuteNonQuery();
}
This gives the script an indefinite amount of time to execute. Ideally, I think another parameter for timeout would be handy, but my hack is working for me now.
Thanks,
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all, Thanks for the tool. I'm finding it very useful for automated builds and rollout scripts. However, I have some scripts that migrate data occasionally. I have run into a scenario where I have a data migration that takes almost 45 minutes. SqlRunner is not setting the commandTimeout before it runs the script, and therefore times out after 30 seconds.
I have modified:
public void Execute( string sqlString )
{
SqlCommand cmd = new SqlCommand( sqlString, _connection );
cmd.ExecuteNonQuery();
}
to:
public void Execute( string sqlString )
{
SqlCommand cmd = new SqlCommand( sqlString, _connection );
cmd.CommandTimeout=0;
cmd.ExecuteNonQuery();
}
This gives the script an indefinite amount of time to execute. Ideally, I think another parameter for timeout would be handy, but my hack is working for me now.
Thanks,
Chris
Chris,
That's a really good point. All of the scripts I'm running at the moment are very short so I haven't hit that problem.
I've applied your change to the code, and I'll post an issue to add a parameter in the future.
Cheers,
Graham