I'm trying to learn about triggers. I'm trying to create a DDL Trigger by creating a new query
create trigger triggername
on quickdb
for create_table
as
begin
print 'new table created'
end
but I keep getting
The specified event type(s) is/are not valid on the specified target object
You shouldn't write the database name in the ON
clause of a DDL trigger, you specify if it's on the database level or on the server level.
If it's on the database level, it will only apply to the database it was created in.
Change your code to this:
use quickdb
go
create trigger triggername
on database
for create_table
as
begin
print 'new table created'
end