-
In the case of sqlserver, you can write a database-based trigger in which you can get the name of the table to be operated on, and sqlserver prohibits the user from deleting the specified table.
If in doubt, communicate in a timely manner!
-
This can be controlled by setting the user's operation permissions on the table.
-
create trigger t1 on reader instead of delete as
delete borrowing where reader number = (select reader number from deleted).
-
create trigger a_del
on [reader] for delete
as--set nocount on
delete e
from [Reader] e
inner join deleted [borrowing] on e.[Reader Number] = [Borrowing].[Reader Number].
-
Needless to say, it's just what kind of mechanism to use to implement it.
1. The trigger is only executed when the data is updated;
2. However, if you delete data, it is generally a scheduled job;
-
This is not a facilitator, you have to use a scheduler and let it run automatically every day.
-
This type of statement is available in later SQL versions.
create trigger trigger name.
on database
for drop_tableas
-
This trigger can be written like this, when someone deletes the data in table A, just execute a statement that will report an error.
-
No value was assigned to @plane seat.
in storage.
while.
Insert "select
plane_seat
plane_seat
frominserted”
-
***table a***
create table [dbo].[test_a](
id_a] [nchar](10) null,col1] [nchar](10) null,col2] [nchar](10) null,col3] [nchar](10) null
on [primary]
**table b***
create table [dbo].[test_b](
id_b] [nchar](10) null,col1] [nchar](10) null,col2] [nchar](10) null,col3] [nchar](10) null
on [primary]
**create trigger***
create trigger [dbo].[tri_test]
on [dbo].[test_a]
after delete
asdelete from test_b where id_b in (select id_a from deleted)
The ID of table A corresponds to the ID of table B
When you delete data in table A, the IDs associated with table B are also deleted.
In addition, foreign keys can achieve the same effect, and if the logic is relatively simple, foreign keys can be used.
-
Let the two table associated fields be:
The id** is as follows:
create trigger trnameon The name of the source table.
for delete
asdelete from destination table name where exists(select 1 from deleted where destination table name. id)
-
It's okay to write a trigger.,How to write it, you just look at the help of SQL.,I didn't give anything.,I can't write it to you.。
-
What do you need to ask?
F get domain contrast is a formatting function (should be written by yourself), the first parameter (arg prod spec id) according to the second parameter (120) formatting and return the result to the v bill code, according to the function naming method, the above ** should be the standard format for getting the date.
sele date,a.win, b, lose from table, (sele date count(result) as win from table where rsult='Win'group by date )a,,(sele date count(result) as pay from table where rsult='Pay'group by date )b where table. date=table. >>>More
select * from log a,(select ,max(date) from logwhere id='10000' >>>More
Enterprise Manager directly with SQL has this feature.
Lili: Landlord, Lily is out of print, there used to be a capsule toy machine, but now there is none, if you want it, there should be no way. >>>More