Hi Friends,

This is my 50th blog on SQL Server Trace Flag 8721 and last in the series of One Trace Flag a Day. I hope you enjoyed this series. You can go to all blogs under that series by clicking here.

There are lots of things which can be discussed about statistics due to its importance in SQL Server. In my previous blogs, I have also covered various things on statistics. Today, I’ll show you the use of trace flag 8721. This trace flag is used to dump information into SQL Server Error log when AutoStat has been run. Let me show you this practically. Run the below code to create the setup which is also having comments to make self explanatory.


Now we will run the below TSQL code to insert the records and triggered an AutoStats.

Now you can check the SQL Server Error log.


From the above output you can see the messages about AUTOSTATS.

Finally do not forget to turn off the trace flag.

PS: Do not use trace flags in production environment without testing it on non production environments and without consulting because everything comes at a cost.


Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook