asp.net - Where exactly to set NOCOUNT ON in stored procedure? -


I want to use stored procedures in asp.net and want to make sure I have the correct syntax. Is there any significant difference between them?

  Select the optional process dbo.mySP @ param1 as f1 to foo where f2 = @ param1 end returns  

if we start to use don , End, or return? Any difference performance-wise?

  Select on SELECT NOCOUNT as the optional process dbo.mySP @ param1 F1 to Foo WHERE F2 = @ param1  

Is this a difference if NOCOUNT Is set up first or later?

  SELECT NOWOUNT Foo from Foo where F2 = @ param1 END  

and SELECT NOCOUNT as alternate process dbo.mySP @ param1 and do we really Need a refund? Visual Studio is included but everything works fine without it. Finally, I have seen that before returning to the results it has suggested to determine NOCATE, but I am not sure why thanks!

Whatever you have mentioned will affect performance, and in fact it is a personal preference , But here's my idea:

No, you do not need a return , unless you want to change the return value by default of 0. It can be from a process

It really does not matter whether or not you have included BEGIN / END , although I would advise you, the main reason errors To protect against, for example, if I want to make a process to select the ID from 2 tables, foo and bar, and run the following:

  Make a proven deobo. Selection ID from Foo; Select the ID from the bar; GO  

will be processed, and I will get the ID from the bar, and the process will only return the ID from Fu. If I had attached this process to BEGIN / END , then it would not be compiled:

  purchase process dabo. Choose Start from FUID ID; Select the ID from the bar; And GO  

You can not keep yourself safe from all the errors and typo, and we all do them from time to time, but every little help!

Finally, with the practice of wrapping the entire process with this BEGIN or BEGIN / END , whether you have SET If I put NOCOUNT or BEGIN before or after it, then I think it would be BEGIN . Should go after.

There is much more to it, and summarize for this specific question. I'm a big fan of all my best practice guides, and this is no exception.


Comments