Error in “Go to origin” — Alert rules notifications

a1

Error is

The form cannot find the context of the alert from here. Try to access the \’Number: 201/2013/2194530, Visa\’ record in a different way.

To fix this error we need to modify the class EVENTCONTEXTDRILLDOWN

a2

Needs to add below code inside drilldown method, code should be similar to existing code of ledgerJournalTable.

a33

Then later you can add range to your main form to filter the specific record

a4

Useful SQL Query (Part 3) – Remove database log from SQL

There are certain needs when you want to remove the database logs. Below SQL query will help you in that.

USE [master]

GO
ALTER DATABASE [TestDb] SET RECOVERY SIMPLE WITH NO_WAIT

DBCC SHRINKFILE(TestDbLog, 1)

ALTER DATABASE [TestDb] SET RECOVERY FULL WITH NO_WAIT

GO

Useful SQL Query (Part 2) – Count of records in each table from SQL

This is very useful query while doing upgrade, you can get the count of records in each table from source and target environment. This helps you with initial level of testing. I found it useful to share.

 DECLARE @QueryString NVARCHAR(MAX) ;  
 SELECT @QueryString = COALESCE(@QueryString + ' UNION ALL ','')  
            + 'SELECT '  
            + '''' + QUOTENAME(SCHEMA_NAME(sOBJ.schema_id))  
            + '.' + QUOTENAME(sOBJ.name) + '''' + ' AS [TableName]  
            , COUNT(*) AS [RowCount] FROM '  
            + QUOTENAME(SCHEMA_NAME(sOBJ.schema_id))  
            + '.' + QUOTENAME(sOBJ.name) + ' WITH (NOLOCK) '  
 FROM sys.objects AS sOBJ  
 WHERE  
    sOBJ.type = 'U'  
    AND sOBJ.is_ms_shipped = 0x0  
 ORDER BY SCHEMA_NAME(sOBJ.schema_id), sOBJ.name ;  
 EXEC sp_executesql @QueryString  

Useful SQL Query (Part 1) – History of Database Restore

History of Database Restore

Sometime in administration work you would like to see history of database restore, like when we have restored this version of data. Usually helps in development and test system.

SELECT [rs].[destination_database_name],
[rs].[restore_date],
[bs].[backup_start_date],
[bs].[backup_finish_date],
[bs].[database_name] as [source_database_name],
[bmf].[physical_device_name] as [backup_file_used_for_restore]
FROM msdb..restorehistory rs
INNER JOIN msdb..backupset bs
ON [rs].[backup_set_id] = [bs].[backup_set_id]
INNER JOIN msdb..backupmediafamily bmf
ON [bs].[media_set_id] = [bmf].[media_set_id]
ORDER BY [rs].[restore_date] DESC

Screen-Shot-2015-01-20-at-12_03_02-PM