06-02-20 04:46 AM
06-02-20 04:50 AM
SELECT [eventdatetime] ,SUBSTRING([sNarrative],11,CHARINDEX('modified',[sNarrative],1)-13) as username ,SUBSTRING([sNarrative],CHARINDEX('environment variable',[sNarrative],1)+22,(Len([sNarrative])-CHARINDEX('environment variable',[sNarrative],1)-22)) as env_var_name ,[sNarrative] ,SUBSTRING([comments],CHARINDEX('Old Value: "',[comments],1)+12,CHARINDEX('", New Value:',[comments],1)-CHARINDEX('Old Value: "',[comments],1)-12) as old_value ,SUBSTRING([comments],CHARINDEX('New Value: "',[comments],1)+12,LEN([comments])-CHARINDEX('New Value: "',[comments],1)-12-2) as new_value ,[comments] FROM [dbo].[BPAAuditEvents] where [sNarrative] like '%modified%environment variable%' order by eventdatetime desc
06-02-20 04:54 AM
Version: BP 5 and above
Query Usage: To track changes to schedule.
Description: This query can be used to know who retired which schedule and when
Disclaimer: This may not be an optimized query. It's given just for knowledge sharing purpose.
SELECT [eventdatetime] ,SUBSTRING([sNarrative],11,CHARINDEX('retired',[sNarrative],1)-13) as username ,SUBSTRING([sNarrative],CHARINDEX('schedule',[sNarrative],1)+10,Len([sNarrative])-CHARINDEX('schedule',[sNarrative],1)-10) as scheduleName ,[sNarrative] ,[comments] FROM [dbo].[BPAAuditEvents] where sNarrative like '%retired%' order by [eventdatetime] desc