December 2008 | SansSQL

Monday, December 29, 2008

@@CONNECTIONS and @@MAX_CONNECTIONS

@@CONNECTIONS returns the number of attempted connections, either successful or unsuccessful since SQL Server was last started.Connections are different from users. For example, Applications can open multiple connections to SQL Server without the user observing the connections.
Syntax: - Select @@CONNECTIONS
@@MAX_CONNECTIONS is the maximum number of connections allowed simultaneously to the SQL server. The number returned is not necessarily the number currently configured. The actual number of user connections allowed also depends on the version of SQL Server installed and the limitations of your applications and hardware.
To Change the max connections, Use sp_configure
Syntax: - Select @@MAX_CONNECTIONS
@@CONNECTIONS is incremented with each login attempt, therefore @@CONNECTIONS can be greater than @@MAX_CONNECTIONS.
 
Example: -
SELECT GETDATE() AS 'Current Date and Time',
@@CONNECTIONS AS 'Login Attempts',
@@MAX_CONNECTIONS AS 'Max Connections Allowed'

Wednesday, December 24, 2008

Code Names of SQL server releases

         SQL Server Release          Project Code Name
 

  1. SQL Server 2008                Katmai
  2. SQL Server 2005                Yukon
  3. SQL Server 2000 64 bit       Liberty
  4. SQL Server 2000 32 bit       Shiloh
  5. SQL Server 7.0                   Sphinx
  6. SQL Server 6.5                   Hydra
  7. SQL Server 6.0                   SQL95

 

Wednesday, December 10, 2008

Add a logo to the Report Manager

Everyone wants to put their custom logo to the Report Manager. Here is how it can be achieved.

You just need to change the below code for .msrs-uppertitle in the ReportingServices.css file which is located at
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager\Styles

Note : Before doing this please backup the ReportingServices.css file for safety.

Put the below code under .msrs-uppertitle and you will be able to see your custom logo on the report Manager.

.msrs-uppertitle
{
BACKGROUND: url(Image Location) no-repeat;
HEIGHT: 35px;
WIDTH: 120px;
TEXT-INDENT: -5000px;
}

Finding Restore and Backup dates

/*Works for both SQL 2000 and SQL 2005 */

USE msdb

GO

SELECT
destination_database_name AS DBRestored ,
restore_date AS RestoreDate ,
RH.USER_NAME AS RestoredBY,
BS.name AS BackupName,
BS.USER_NAME AS DBBackedUpBY,
BS.server_name SourceServerName,
BackupType= CASE
                       when BS.type='D'  Then 'Database '
                       when BS.type='I'   Then 'Differential database'
                       when BS.type='L'  Then 'Log'
                       when BS.type='F'  Then 'File or filegroup'
                       when BS.type='G'  Then 'Differential file'
                       when BS.type='P'  Then 'Partial '
                       when BS.type='Q'  Then 'Differential partial '
END,
BS.database_name AS SourceDB,
physical_name AS SourceFile,
backup_start_date AS BackupDate
FROM RestoreHistory RH
INNER JOIN BackupSet BS
ON RH.backup_set_id = BS.backup_set_id
INNER JOIN BackupFile BKF
ON BKF.backup_set_id = BS.backup_set_id
WHERE destination_database_name='pubs'
ORDER BY RestoreDate

Ads