Monday, August 24, 2015

how to use set no count on and set no count off

Set no count on/set no count off turn off /turns on displaying messages after executing sql query’s for each statement, this is very use full in store procedures for preventing frequent messages like(inserted,updated,deleted,affected kind of messages) after query executions. this improves the performance of T-sql statements, number of hits the database reduced a bit,

Example for set no count on/off:-

Here set no count on not used, that’s sql ide returns “16 rows affected”

Here set no count on used, that’s sql ide not returns any rows messages like  “16 rows affected”