SQL @@TOTAL_WRITE

SQL @@TOTAL_WRITE is a System Statistical Function, returns the total disk writes since the last time the SQL server started. The syntax behind this is @@TOTAL_WRITE is

@@TOTAL_WRITE

SQL @@TOTAL_WRITE Example

The following code snippet will show you the total number of disk writes for this SQL Server.

-- SQL Server @@TOTAL_WRITE Example
SELECT @@TOTAL_WRITE AS [Total Number of Writes]
SQL @@TOTAL_WRITE Example 1

You can also use the GETDATE() function along with the Total_write function to see the total writes until today.

-- SQL Server @@TOTAL_WRITE  Example
SELECT @@TOTAL_WRITE AS [Total Number of Writes],
		GETDATE() AS [As of Today]
SQL @@TOTAL_WRITE Example 2

@@TOTAL_WRITE Example 2

In this SQL @@TOTAL_WRITE example, we are using both the Total Writes and Total Reads, along with Today’s date

-- SQL Server @@TOTAL_WRITE  Example
SELECT @@TOTAL_WRITE AS [Total Number of Writes],
	   @@TOTAL_READ AS [Total Number of Reads],
		GETDATE() AS [As of Today]
SQL @@TOTAL_WRITE Example 3