- SET NOCOUNT ON will prevent a message being returned saying how many rows were updated. In some situations in code this is necessary because the message is interpreted as an additional resultset. There is also some additional overhead with this message.
-
CURSORS are used to perform operations in a procedural fashion instead of the usual set based fashion (for instance if you need to loop through some data executing a stored procedure for every row). They are quite resource-intensive and usually frowned upon. It appears that this could be re-written without a cursor.
-
“##Motability_Comms_Combined is a global temporary table, so may also be referred to by other code (in a different SQL connection)
4
solved SQL Server Loop and Cursors [closed]