| |

VerySource

 Forgot password?
 Register
Search
View: 754|Reply: 5

Two questions about triggers and FK

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-27 19:00:01
| Show all posts |Read mode
1 Can you use objects outside the database in the trigger, such as a table in a database (located on the same database server)
2.Can the FK of a table come from a primary key of multiple tables?
Means from a table, or from a table

Please help and tell how to achieve
Reply

Use magic Report

0

Threads

211

Posts

108.00

Credits

Newbie

Rank: 1

Credits
108.00

 China

Post time: 2020-2-21 18:00:01
| Show all posts
1 Can you use objects outside the database in the trigger, such as a table in a database (located on the same database server)


it should be OK
Reply

Use magic Report

0

Threads

211

Posts

108.00

Credits

Newbie

Rank: 1

Credits
108.00

 China

Post time: 2020-2-21 19:45:01
| Show all posts
2.Can the FK of a table come from a primary key of multiple tables?
Means from a table, or from a table

It's better not to be too fancy
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-2 23:45:01
| Show all posts
Tables that can trigger another database
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-3-9 22:30:01
| Show all posts
It's not even a heart ...
Now there are four kinds of devices, A, B, C, D
I put their data into four watches
Each device has its own unique ID, namely A.ID, B.ID, C.ID, D.ID
Now I want to have a table to store their failure information
Dev_ID may be the value of table A, maybe the value of table B, maybe ...
How to achieve this?
And they are not in the same database, but in the same server
Please help
Reply

Use magic Report

0

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-5 16:15:01
| Show all posts
This kind of business logic is best to use triggers to check, because you use the columns of multiple other tables to check the validity of a column of a table. Use triggers to implement your business logic when inserting or updating this column of this table!
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