nocount

Microsoft Sync Framework clashes with Nhibernate TooManyRowsAffectedexception

旧街凉风 提交于 2019-12-19 03:25:11
问题 We are trying to implement the Microsoft Sync Framework into our application that persists it's domain using NHibernate. One of the problems we encountered is that after the Sync Framework has altered your initial database structure (adding shadow tables and triggers) NHibernate seems to get upset by throwing an toomanyrowsaffectedexception when you try to insert objects into the database. I found this article that has the solution of adding SET NOCOUNT ON and OFF around each update statement

MS SQL: Suppress return value of stored procedure called in stored procedure

空扰寡人 提交于 2019-12-09 02:46:34
问题 I think I have the same problem as kcrumley describes in the question "Problem calling stored procedure from another stored procedure via classic ASP". However his question does not really include an solution, so I'll give it another shot, adding my own observations: I have two stored procedures: CREATE PROCEDURE return_1 AS BEGIN SET NOCOUNT ON; SELECT 1 END CREATE PROCEDURE call_return_1_and_return_2 AS BEGIN SET NOCOUNT ON; EXEC return_1 SELECT 2 END Note that both procedures contain "SET

SET NOCOUNT OFF or RETURN @@ROWCOUNT?

为君一笑 提交于 2019-12-05 13:25:09
问题 I am creating a stored procedure in Sql Server 2008 database. I want to return the number of rows affected. Which is a better option SET NOCOUNT OFF or RETURN @@ROWCOUNT? ALTER PROCEDURE [dbo].[MembersActivateAccount] @MemberId uniqueidentifier AS BEGIN -- Should I use this? SET NOCOUNT OFF; UPDATE [dbo].Members SET accountActive = 1 WHERE id = @MemberId; --Or should I SET NOCOUNT ON and use the following line instead? --return @@ROWCOUNT; END I know that both work, but which is a better

SET NOCOUNT OFF or RETURN @@ROWCOUNT?

时间秒杀一切 提交于 2019-12-04 00:32:20
I am creating a stored procedure in Sql Server 2008 database. I want to return the number of rows affected. Which is a better option SET NOCOUNT OFF or RETURN @@ROWCOUNT? ALTER PROCEDURE [dbo].[MembersActivateAccount] @MemberId uniqueidentifier AS BEGIN -- Should I use this? SET NOCOUNT OFF; UPDATE [dbo].Members SET accountActive = 1 WHERE id = @MemberId; --Or should I SET NOCOUNT ON and use the following line instead? --return @@ROWCOUNT; END I know that both work, but which is a better choice and why? After some trying I am coming to a conclusion that SET NOCOUNT is OFF by default inside

Microsoft Sync Framework clashes with Nhibernate TooManyRowsAffectedexception

落花浮王杯 提交于 2019-11-30 21:45:54
We are trying to implement the Microsoft Sync Framework into our application that persists it's domain using NHibernate. One of the problems we encountered is that after the Sync Framework has altered your initial database structure (adding shadow tables and triggers) NHibernate seems to get upset by throwing an toomanyrowsaffectedexception when you try to insert objects into the database. I found this article that has the solution of adding SET NOCOUNT ON and OFF around each update statement, but since the table structure is automatically generated by nhibernate and the sync triggers are

What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries?

非 Y 不嫁゛ 提交于 2019-11-30 17:43:14
What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ From SQL BOL: SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, setting SET NOCOUNT to ON can provide a significant performance boost , because network traffic is greatly reduced. See http://msdn.microsoft.com/en-us/library/ms189837.aspx for more details. Also, this article on SQLServerCentral is great on this subject:

What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries?

回眸只為那壹抹淺笑 提交于 2019-11-30 16:41:22
问题 What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ 回答1: From SQL BOL: SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, setting SET NOCOUNT to ON can provide a significant performance boost , because network traffic is greatly reduced. See http://msdn.microsoft.com/en