/****** Object: DdlTrigger [trig_BackUpDbObjects] Script Date: 04/09/2009 20:55:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create trigger [trig_BackUpDbObjects]
on database
for create_procedure, alter_procedure, drop_procedure,
create_table, alter_table, drop_table,
create_function, alter_function, drop_function
as
set nocount on
declare @data xml
set @data = EVENTDATA()
declare @DbVersion varchar(20)=(select ga.GetDbVersion())
declare @DbName varchar(256)=@data.value('(/EVENT_INSTANCE/DatabaseName)[1]', 'varchar(256)')
declare @DbType varchar(50)=(select ga.GetDbType())
declare @EventType varchar(256)=@data.value('(/EVENT_INSTANCE/EventType)[1]', 'varchar(50)')
declare @ObjectName varchar(256) = @data.value('(/EVENT_INSTANCE/ObjectName)[1]', 'varchar(256)')
declare @ObjectType varchar(25) = @data.value('(/EVENT_INSTANCE/ObjectType)[1]', 'varchar(25)')
declare @TSQLCommand varchar(max) = @data.value('(/EVENT_INSTANCE/TSQLCommand)[1]', 'varchar(max)')
declare @LoginName varchar(256) = @data.value('(/EVENT_INSTANCE/LoginName)[1]', 'varchar(256)')
declare @FirstName varchar(50)= (select [FirstName] from [ga].[tb_BLSec_LoginsForUsers] where [LoginName] = @LoginName)
declare @LastName varchar(50) = (select [LastName] from [ga].[tb_BLSec_LoginsForUsers] where [LoginName] = @LoginName)
select column_name from information_schema.columns where table_name ='tb_DataMeta_ObjChangeLog'
insert into [ga].[tb_DataMeta_ObjChangeLog]
(
[DatabaseName] ,
[DbVersion] ,
[DbType],
[EventType],
[ObjectName],
[ObjectType] ,
[SqlCommand] ,
[LoginName] ,
[FirstName],
[LastName]
)
values(
@DbName,
@DbVersion,
@DbType,
@EventType,
@ObjectName,
@ObjectType ,
@TSQLCommand,
@LoginName ,
@FirstName ,
@LastName
)
-- if eventType like create -> add ext props ;
-- if eventType like alter -> update ext props ;
-- if eventType like drop ->
-- select name from sys.tables where name like '%ext%'
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
DISABLE TRIGGER [trig_BackUpDbObjects] ON DATABASE
GO
ENABLE TRIGGER [trig_BackUpDbObjects] ON DATABASE
GO
Getting the Current TabItem when the Tab is not selected in WPF
-
[image: Banner]
This is a quick reminder to self on how to retrieve a TabItem from a WPF
TabControl *when the tab is not currently selected* because I ru...
2 weeks ago
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!