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 |
|
rohit04413
Yak Posting Veteran
72 Posts |
Posted - 2010-05-05 : 01:24:30
|
| hello all !!!i have a table with 2 columns DateIn and DateOut.i want to have a 3rd column which automatically calculate difference between datein and dateout as number of days.how can i do that? may i use the computed column specification property of the 3rd column. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-05-05 : 01:36:04
|
yes.alter table <table name> addDiffDays as datediff(day, DateIn, DateOut) KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-05 : 02:26:48
|
| do you mean absolute days thats passed or number of equivalent days based on elapsed hours?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
rohit04413
Yak Posting Veteran
72 Posts |
Posted - 2010-05-05 : 02:40:24
|
quote: Originally posted by khtan yes.alter table <table name> addDiffDays as datediff(day, DateIn, DateOut) KH[spoiler]Time is always against us[/spoiler]
ThankYou.i just put datediff(day, DateIn, DateOut) into computed column specification and it worked out. |
 |
|
|
|
|
|