Hi all,
How to use SET NOCOUNT ON and why to use in SQL Server .
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
geetha velusamyPosted Nov 12, 2021, 1:03 PM
SET NO COUNT ON:
SET NO COUNT is ON the count is not returned.
Sample Query for SET NO COUNT ON:
SET NOCOUNT ON;
GO
SELECT [empid]
,[empname]
,[email]
,[address]
FROM [emp]
SET NO COUNT OFF:
SET NO COUNT is OFF it returns the count of rows affected.
Sample Query for SET NO COUNT OFF:
SET NOCOUNT OFF;
GO
SELECT [empid]
,[empname]
,[email]
,[address]
FROM [emp]
Vinitha TPosted Nov 8, 2021, 1:56 PM
SET NOCOUNT ON - This prevent to display number of row(s) affected and will display as Commands completed successfully in message tab
SET NOCOUNT OFF - This display number of row(s) affected.
Mageshwaran RPosted Nov 5, 2019, 8:58 AM
Subbarao APosted Jul 10, 2019, 3:22 AM
Sivakumar KonetiPosted Jul 9, 2019, 12:48 AM
Rajanikant HawaldarPosted Jul 8, 2019, 3:42 AM
Amit MohantyPosted Jul 8, 2019, 3:26 AM
https://www.c-sharpcorner.com/blogs/set-nocount-on-and-set-nocount-off-using-stored-procedure-in-sql-server
https://www.tutorialgateway.org/sql-set-nocount-on/
https://www.tech-recipes.com/rx/56506/sql-server-set-nocount-on-statement-with-examples/
Madan ShekarPosted Jul 8, 2019, 3:25 AM