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 |
|
panthagani
Yak Posting Veteran
58 Posts |
Posted - 2007-11-07 : 13:18:13
|
| How would you create a column which displays the difference of two other columns in SQL? For example, column C=column A – column B.My idea is that when ever data enters column A and column B, column C should show the difference of the two automatically. A, B and C are datetime columns. I'm looking at setting up an 'after' trigger on the table. Is there a better approach? Thanks. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-07 : 13:20:20
|
compute column ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
panthagani
Yak Posting Veteran
58 Posts |
Posted - 2007-11-07 : 14:00:08
|
| KH, Thanks a ton sir. That solves my problem! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-09 : 01:27:30
|
| or in your select statement have itSelect column A ,column B, column A – column B as column C from tableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|