Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-02-07 : 10:11:47
|
| Hammamur writes "Hi, I have a few sql questions.1) I want to update the field of one table after a user enters something in a another tabele. e.g.In the Products table there is field called stock count. I want this field to be decremented after a field called quantity sold is updated in the sales order table.2) How can you restrict/check that a user has enterd a valid id number. e.g.I have a customer table, which has a key field called customer number. When sales order information is enterd in the sales order table, there is a customer number field whcih needs to be also entered. How can I check that a user has entered a customer that exists in the customer table?Thank you very much." |
|
|
andre
Constraint Violating Yak Guru
259 Posts |
Posted - 2002-02-07 : 10:16:56
|
quote: 1) I want to update the field of one table after a user enters something in a another tabele. e.g. In the Products table there is field called stock count. I want this field to be decremented after a field called quantity sold is updated in the sales order table.
You could do both steps in a stored procedure or use an update trigger. quote: I have a customer table, which has a key field called customer number. When sales order information is enterd in the sales order table, there is a customer number field whcih needs to be also entered. How can I check that a user has entered a customer that exists in the customer table?
In my opintion, the best way is to use constraints. Another option is to use a trigger. If you search for trigger on this site, you'll find several articles. |
 |
|
|
|
|
|