Some useful SQL Server Properties:
- @@CONNECTIONS - Returns the number of connections, or attempted connections, since Microsoft® SQL Server™ was last started.
- @@MAX_CONNECTIONS - Returns the maximum number of simultaneous user connections allowed on a Microsoft® SQL Server™.
- @@CPU_BUSY - Returns the time in milliseconds (based on the resolution of the system timer) that the CPU has spent working since Microsoft® SQL Server™ was last started.
- @@CURSOR_ROWS - Returns the number of qualifying rows currently in the last cursor opened on the connection.
- @@DBTS - Returns the value of the current timestamp data type for the current database. This timestamp is guaranteed to be unique in the database.
- @@ERROR - Returns the error number for the last Transact-SQL statement executed.
- @@TOTAL_ERRORS - Returns the number of disk read/write errors encountered by Microsoft® SQL Server™ since last started.
- @@FETCH_STATUS - Returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.
- @@IDENTITY - Returns the last-inserted identity value.
- @@LANGID - Returns the local language identifier (ID) of the language currently in use.
- @@LANGUAGE - Returns the name of the language currently in use.
- @@REMSERVER - Returns the name of the remote Microsoft® SQL Server™ database server as it appears in the login record.
- @@SERVERNAME - Returns the name of the local server running Microsoft® SQL Server™.
- @@VERSION - Returns the date, version, and processor type for the current installation of Microsoft® SQL Server™.
Use them like this:
There are also many useful built-in Stored Procedures, like:Code:SELECT @@IDENTITY AS id
- sp_helpdb - Reports information (name, db_size, owner, dbid, created, status) about a specified database or all databases.
- sp_helplogins - Provides information about logins and the associated users in each database.
Use them like this:
Code:EXEC sp_helpdb GO EXEC sp_help_logins('sa') GO