.net - SQLDatareader via CLR not returning SQL Message right way -


I execute the following code via CLR, there is no reason why the message has not been printed on the SQL Server , It is required unless the stored procedure returns all the rows (there are approximately 7 billion rows to return)

  SqlCommand cmd = new SqlCommand (); Cmd.Connection = conn; Cmd.CommandType = CommandType.StoredProcedure; Cmd.CommandText = "spCommand_Select_Rows_For_Delete"; CMD. Comma timeout = 41600; SqlDataReader Reader = cmd.ExecuteReader (); {String strSQL = ""; SqlContext.Pipe.Send (DateTime.Now.ToString () + "- Start working with ProductTable"); While (reader.Read ()) {strSQL = "Remove from product qualified product product =" + Reader ["Product ID"] Toasting (); SqlCommand cmdDelete = New SqlCommand (strSQL, conn); CmdDelete.Connection = conn; CmdDelete.CommandTimeout = 20800; CmdDelete.ExecuteNonQuery (); } SqlContext.Pipe.Send (DateTime.Now.ToString () + "- Completed work with ProductTable"); } Finally {// Always call closed reader.Close (); }  

My stored procedure:

  Select product from product Productivity where ProductInfoId (Seleted ProductInfoId from DeletedProducts)  

Here you remove 7 billion lines using a good set-based operation. You do not repeat abuse through a detor in CLR.

  Select 'Start''s "Rochett" and & lt; & Gt; 0 Dillat Top (1000000) Where productive P is present from P. (Selection * DP WHERE P.ProductInfoId = DP.ProductInfoId from Deleted Products)  

For more, see this question

But to answer your question, yes, SQL Server will not be immediately (which you are doing) immediately


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -