SQL - @@PACK_RECEIVED Function
The SQL @@PACK_RECEIVED statistical function is used to retrieve the number of input packets. It returns the total number of input( or received) packets read from the network by SQL server since it was last started.
In SQL, the Packets are fixed-size chunks of data that transfer requests and results between clients and servers. The default package size is 4096 bytes(1 byte = 8 bits).
Syntax
Following is the syntax of the SQL @@PACK_RECEIVED function −
@@PACK_RECEIVED
Return type
The return type of this function is an INTEGER.
Parameters
It does not accept any parameters.
Return value
This function returns the number of input packets.
Example
In the following example,we are using the SQL @@PACK_RECEIVED function to retrieve the number of input packets read from the network by SQL server.
SELECT @@PACK_RECEIVED AS Input_packets;
Output
The above program produces the following output −
+--------------+ | Input_packets| +--------------+ | 10034 | +--------------+
Example
The following is another example of the SQL @@PACK_RECEIVED function. You can also use the GETDATE() function along with this function to retrieve the number of input packets until today read from the network by the SQL server since it was last started.
SELECT GETDATE() AS Todays_date, @@PACK_RECEIVED AS Total_inp_packets;
Output
On executing the above program, it will produce the following output −
+-------------------------+-------------------+ | Todays_date | Total_inp_packets | +-------------------------+-------------------+ | 2023-03-01 11:13:15.430 | 10047 | +-------------------------+-------------------+