这个语法如何理解?
-- =============================================
-- Create basic Instead Of Trigger
-- =============================================
IF EXISTS (SELECT name
FROM sysobjects
WHERE name = N'<trigger_name, sysname, trig_test>'
AND type = 'TR')
DROP TRIGGER <trigger_name, sysname, trig_test>
GO
CREATE TRIGGER <trigger_name, sysname, trig_test>
ON <table_or_view_name, sysname, pubs.dbo.sales>
INSTEAD OF INSERT
AS
BEGIN
RAISERROR (50009, 16, 10)
EXEC sp_who
END
GO
请问<trigger_name, sysname, trig_test>这个语法如何理解:<,>,trigger_name,sysname各代表什么?谢谢!
------解决方案--------------------单从字面意思看,trigger_name:触发器名、sysname:系统名
触发器语法:
Trigger on an INSERT, UPDATE, or DELETE statement to a table or view (DML Trigger)
CREATE TRIGGER [ schema_name . ]trigger_name
ON { table
------解决方案-------------------- view }
[ WITH <dml_trigger_option> [ ,...n ] ]
{ FOR
------解决方案-------------------- AFTER
------解决方案-------------------- INSTEAD OF }
{ [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] }
[ WITH APPEND ]
[ NOT FOR REPLICATION ]
AS { sql_statement [ ; ] [ ,...n ]
------解决方案-------------------- EXTERNAL NAME <method specifier [ ; ] > }
<dml_trigger_option> ::=
[ ENCRYPTION ]
[ EXECUTE AS Clause ]
<method_specifier> ::=
assembly_name.class_name.method_name
Trigger on a CREATE, ALTER, DROP, GRANT, DENY, REVOKE, or UPDATE STATISTICS statement (DDL Trigger)
CREATE TRIGGER trigger_name
ON { ALL SERVER
------解决方案-------------------- DATABASE }
[ WITH <ddl_trigger_option> [ ,...n ] ]
{ FOR
------解决方案-------------------- AFTER } { event_type
------解决方案-------------------- event_group } [ ,...n ]
AS { sql_statement [ ; ] [ ,...n ]