Tuesday, 27 February 2018

Microsoft SQL System Functions

-- Microsoft SQL System Functions

select @@CONNECTIONS;
-- outputs the number of successful and unsuccessful connections

select @@CPU_BUSY;
--tells you how long sql server has been up and running in seconds.

select @@CURSOR_ROWS;
--says how many rows are in the last cursor.

select @@DATEFIRST;
--shows the current day of week for set date first.

select @@DBTS;
-- shows timestamp datatype for this database.

select @@DEF_SORTORDER_ID;
-- this produces the same results as serverporperty('sqlsortorder')
select SERVERPROPERTY('SQLSortOrder');

select @@DEFAULT_LANGID;
--Default language identifier ID.

select @@ERROR;
--This is an error number.  displays 0 if there is no error.

select @@FETCH_STATUS;
--Based on cursor and returns the last fetch status of the cursor.

select @@IDENTITY;
--displays the last identity value inserted based on increment.

select @@IDLE;
--displays idle time since sql server started in seconds.

select @@IO_BUSY;
--displays time spent on input and output operations since sql startup in seconds.

select @@LANGID;
--displays the language identifier ID.

select @@LANGUAGE;
--displays the language setting of sql server, e.g. US_English.

select @@LOCK_TIMEOUT;
--displays the lock timeout setting.  if enabled -1, if not enables 0.

select @@MAX_CONNECTIONS;
--displays the maximum number of connections since sql log in.

select @@MAX_PRECISION;
--displays the decimal precision and numeric precision for these data types in sql server.

select @@MICROSOFTVERSION;
-- displays microsoft sql version numbering information.

select @@NESTLEVEL;
-- displays the nested level for stored procedures created.

select @@OPTIONS;
-- displays sql server set options information

select @@PACK_RECEIVED;
-- displays the number of transmitted packets received by sql server through the network.

select @@PACK_SENT;
-- displays the number of packets sent or transmitted through the network.

select @@PACKET_ERRORS;
-- displays the number of errors when receiving or transmitting packets trhough the network.

select @@PROCID;
-- displays the procedure or process ID for T_SQL objects, which are UDFs, Stored Procedures, and Triggers.

select @@REMSERVER;
-- if you are remotely connected over a network server it displays the sql server connection name.

select @@ROWCOUNT;
-- displays the number of rows displayed or affected by the last statement.

select @@SERVERNAME;
-- displays the server connection name whether local or remote.

select @@SERVICENAME;
-- displays the sql service name you are running on, e.g. sql express.

select @@SPID;
-- displays the current user session ID number.

select @@TEXTSIZE;
-- displays the maximum character length of text data type column.

select @@TIMETICKS;
-- displays how many microsends there are in a tick.

select @@TOTAL_ERRORS;
-- displays number of disk drive sql server errors since log in.

select @@TOTAL_READ;
-- displays how many disk drive readings since sql server startup.

select @@TOTAL_WRITE;
-- displays how many disk writes there are since sql server start up.

select @@TRANCOUNT;
-- displays how many "begin transactions" have run in the current open session.

select @@VERSION;
-- displays microsoft sql version of software, copyright, and some system requirements details.

No comments:

Post a Comment