BCP process request timeout
Padmanabhan, Venkatesh
246
Reputation points
Hi.
I am using BCP command in a .NET console application.
The query returns around 6,00,000 rows and takes 5 mins 43 seconds when running the query in SSMS.
My bcp command looks like this:
BCP "SELECT columns FROM tablename where condition " queryout "Pathand FileName" -T -S ServerName -d DatabaseName -b 500 -c -C 65001 -t~
The overall code is:
using (var process = new Process())
{
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.FileName = "BCP";
process.StartInfo.Arguments = "\"" + Query + " \" queryout " + "\"" + fileName.Trim() + "\"" + " -T -S " + servername + " -d " + dbinstance + " -b 500 -c -C 65001 -t~";
process.Start();
process.BeginOutputReadLine();
process.WaitForExit();
string stderr = process.StandardError.ReadToEnd();
}
How to fix this timeout issue ? Thanks
SQL Server | Other
14,503 questions
Sign in to answer