CLR을 통해 다음 코드를 실행합니다. SQL Server에 메시지가 인쇄되지 않는 이유는 무엇입니까? 저장 프로 시저가 모든 행을 반환 할 때까지 기다려야합니다. 약 7 억 행CLR을 통한 SQLDatareader가 SQL 메시지를 올바르게 반환하지 않음
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "spCommand_Select_Rows_For_Delete";
cmd.CommandTimeout = 41600;
SqlDataReader reader = cmd.ExecuteReader();
try
{
string strSQL = "";
SqlContext.Pipe.Send(DateTime.Now.ToString() + " - Started working with ProductTable");
while (reader.Read())
{
strSQL = "DELETE FROM ProductTable WHERE ProductId = " + reader["ProductId"].ToString();
SqlCommand cmdDelete = new SqlCommand(strSQL, conn);
cmdDelete.Connection = conn;
cmdDelete.CommandTimeout = 20800;
cmdDelete.ExecuteNonQuery();
}
SqlContext.Pipe.Send(DateTime.Now.ToString() + " - Completed working with ProductTable");
}
finally
{
// Always call Close when done reading.
reader.Close();
}
내 저장 프로 시저)를 호출하는 것입니다 :
SELECT ProductId FROM ProductTable
WHERE ProductInfoId IN
(
SELECT ProductInfoId from DeletedProducts
)
저장 프로 시저의 70 억 개의 행이 있습니까? 따라서 더 큰 행 ***에서 70 억 개의 행을 하나씩 삭제합니다 ***. – gbn
와우 그래서 RBAR에 A가 있습니다. –