Reputation: 6081
I am trying to build a small T-SQL database. And being a good programmer, I obviously looked up all reserved keywords to avoid using these as names (I found a list from Microsoft). The word "event" is not in the list, so I decided to use that (not just because it wasn't in the list of course).
However, when I write it in SQL Server Management Studio, the name is highlighted with blue, as you can see below. Why is that, if it is not a reserved keyword?
Upvotes: 4
Views: 1927
Reputation: 6612
Using Events or SQL Server Extended Event data, database programmers can handle events with the help of DDL triggers . For example, you can log when a table is dropped, here is the DDL trigger codes for this
CREATE TRIGGER trigger_name
ON { ALL SERVER | DATABASE }
[ WITH <ddl_trigger_option> [ ,...n ] ]
{ FOR | AFTER } {*event_type | event_group } [ ,...n ]
AS { sql_statement [ ; ] [ ,...n ] | EXTERNAL NAME < method specifier > [ ; ] }
Upvotes: 0
Reputation: 13146
It is a special keyword for SQL server. As you can see;
So, I suggest you to don't use this kind of keywords to don't get confusion.
Also, still if you want to stay with this keyword, you can provide the query with []
like omr.[event]
Upvotes: 3