| |

VerySource

 Forgot password?
 Register
Search
View: 801|Reply: 3

A question about triggers

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-9 16:30:01
| Show all posts |Read mode
A table fields
id
num

Table B fields
id
num

Table association a.id = b.id


problem:

How can the num of table a be changed when the num of table b is modified? Make a.num = b.num
Reply

Use magic Report

0

Threads

114

Posts

69.00

Credits

Newbie

Rank: 1

Credits
69.00

 China

Post time: 2020-4-3 16:30:01
| Show all posts
create trigger aa on b
for update
as
if update (num)
begin
update a set a.num = b.num from b b, inserted where a.id = b.id
end
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 Australia

Post time: 2020-4-5 11:45:01
| Show all posts
The landlord, if the two tables do not have a primary key connection relationship, it cannot be achieved, and it is not practical.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-4-5 14:30:01
| Show all posts
Table association a.id = b.id
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list