Hello ALL
I am trying to stop the unauthorised attachment of a database. Yes, I have asked this before and yes ... I am using encryption.
But I have become intrigued with tee DDL triggers. In principle I want to detach on attach, as I have scripted below
Create Trigger [All_Events]
On Database
For DDL_DATABASE_LEVEL_EVENTS
AS
Declare @Test as nvarchar(10);
if exists (select * from master.INFORMATION_SCHEMA.columns where table_name = 'Authentication' and column_name = 'Authentication')
begin
select @Test=Authentication from master.dbo.authentication
if @Test <> 'Bollocks'
begin
sp_detach_db 'test'
end
end
else
begin
sp_detach_db 'test'
end
But it just doesn't work.
Any ideas?
I am trying to stop the unauthorised attachment of a database. Yes, I have asked this before and yes ... I am using encryption.
But I have become intrigued with tee DDL triggers. In principle I want to detach on attach, as I have scripted below
Create Trigger [All_Events]
On Database
For DDL_DATABASE_LEVEL_EVENTS
AS
Declare @Test as nvarchar(10);
if exists (select * from master.INFORMATION_SCHEMA.columns where table_name = 'Authentication' and column_name = 'Authentication')
begin
select @Test=Authentication from master.dbo.authentication
if @Test <> 'Bollocks'
begin
sp_detach_db 'test'
end
end
else
begin
sp_detach_db 'test'
end
But it just doesn't work.
Any ideas?