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;
}
Wednesday, December 10, 2008
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
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
Labels:
MSSQL,
SQL Queries
Tuesday, November 18, 2008
Query to Find time remaining to complete database backup or restore in SQL 2005
USE master
GO
SELECT
Percent_Complete,
Start_Time ,
Command,
b.Name AS DatabaseName, --Sometimes this will be "Main" as the database will not be accesiable.
DATEADD(ms,estimated_completion_time,GETDATE()) AS RemainTime,
(estimated_completion_time/1000/60) AS MinutesToFinish
FROM sys.dm_exec_requests a
INNER JOIN sys.databases b
ON a.database_id = b.database_id
WHERE
Command like '%Restore%'
OR Command like '%Backup%'
AND Estimated_Completion_Time > 0
GO
SELECT
Percent_Complete,
Start_Time ,
Command,
b.Name AS DatabaseName, --Sometimes this will be "Main" as the database will not be accesiable.
DATEADD(ms,estimated_completion_time,GETDATE()) AS RemainTime,
(estimated_completion_time/1000/60) AS MinutesToFinish
FROM sys.dm_exec_requests a
INNER JOIN sys.databases b
ON a.database_id = b.database_id
WHERE
Command like '%Restore%'
OR Command like '%Backup%'
AND Estimated_Completion_Time > 0
Labels:
SQL Queries
When was my table last scaned or updated?
USE DatabaseName
GO
SELECT
t.name,
i.last_user_lookup,
i.last_user_scan,
i.last_user_seek,
i.last_user_update
FROM sys.dm_db_index_usage_stats i
INNER JOIN sys.tables t
ON i.object_id = t.object_id
WHERE
database_id = db_id( 'DatabaseName' )
GO
SELECT
t.name,
i.last_user_lookup,
i.last_user_scan,
i.last_user_seek,
i.last_user_update
FROM sys.dm_db_index_usage_stats i
INNER JOIN sys.tables t
ON i.object_id = t.object_id
WHERE
database_id = db_id( 'DatabaseName' )
Labels:
SQL Queries
Monday, November 17, 2008
Find Domain Name Using T-SQL
DECLARE @Domain varchar(100), @key varchar(100)
SET @key = 'SYSTEM\ControlSet001\Services\Tcpip\Parameters\'
EXEC master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key=@key,@value_name='Domain',@value=@Domain OUTPUT
SELECT 'Server Name: '+@@servername + ' Domain Name:'+convert(varchar(100),@Domain)
Alternative ways,
1. SELECT DEFAULT_DOMAIN()
2. EXEC Master.dbo.xp_LoginConfig 'Default Domain'
SET @key = 'SYSTEM\ControlSet001\Services\Tcpip\Parameters\'
EXEC master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key=@key,@value_name='Domain',@value=@Domain OUTPUT
SELECT 'Server Name: '+@@servername + ' Domain Name:'+convert(varchar(100),@Domain)
Alternative ways,
1. SELECT DEFAULT_DOMAIN()
2. EXEC Master.dbo.xp_LoginConfig 'Default Domain'
Subscribe to:
Posts (Atom)