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-04-09 : 09:30:53
|
| Matt writes "I was wondering if the following is possible to do and if so how?I have two different tables in my database, in Table "a" column 1 has a default value of "50", now what I want to do is when I pull up all the info for table "a" instead of always returning column 1's information as "50" it will go out and look at column 1 of table "b" and then add that number (say 10) to table "a" column 1. So the returned info for column 1 of table "a" is "60". But I also want it so when I update table "b" the information given when I query table "a" is dynamically updated, so if table "b" column 1 is changed to 30 then the query returns "80" for table "a" column 1.I am ruing on a Window 2000 SP2 server with Microsoft SQL Server 2000 (I think SP 2)" |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-04-09 : 09:57:03
|
| I think what you're getting at is you want some way for SQL Server to reflect a change in one table in other tables. To put a more specific example out there than tables a and b, if you had a banking database with a "transactions table" and an "accounts" table, for performance you might want the database to automatically update the balance column in accounts whenever a transaction was made (inserted) against an account.SQL Server provides two mechanisms for doing this: triggers and materialized views. I would start with triggers; read up on them in BOL.setBasedIsTheTruepath<O> |
 |
|
|
wblackmon
Starting Member
3 Posts |
Posted - 2002-04-09 : 12:16:50
|
| Where do you find these BOL?thanks,Will BlackmonInformation TechnologyBank of Alabama |
 |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2002-04-09 : 12:31:20
|
| Here's a link to download Books Online: http://www.microsoft.com/sql/techinfo/productdoc/2000/books.aspThey should also be installed by default when you install the client tools.===============================================Creating tomorrow's legacy systems today.One crisis at a time. |
 |
|
|
|
|
|