A
A
Anton2015-10-28 20:27:07
Transact SQL
Anton, 2015-10-28 20:27:07

How to properly create triggers (T-SQL)?

Hello!
On the Internet, including MSDN itself, I could not find a suitable example of a request for creating a trigger - some kind of error always gets out.
For example, I'm trying to create an audit for the "players" table and already on the first line I get an error:
edf24823d5054f0192e4de631ca255a3.png
The "players" table exists, there are fields in it. It's even full.
What is the problem and how to solve it?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton, 2015-11-12
@hummingbird

It is necessary to write at the very beginning USE <data_name> GO

A
Aleksey Ratnikov, 2015-10-28
@mahoho

Try to specify the table name in full: db_name.dbo.players. Management Studio exports the created triggers in this form.

A
Artur Polozov, 2015-10-29
@Noxy

most likely management studio has not yet updated the cache and does not know about the presence of the table.
try CTRL + SHIFT + R - Refresh.
SQL Server Management Studio Keyboard Shortcuts

A
Alexey Shumkin, 2015-10-29
@ashumkin

1. The table playersexists in the same schema - dbo?
2. Collation base case insensitive? If not: the table is called players, not Players(or plAyers, etc) ;) ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question