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 |
|
itay1978
Starting Member
1 Post |
Posted - 2004-09-23 : 17:35:06
|
| i have two datetime fields.how can i do some query that will give me the results for date1 - date2?Thanks |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-09-23 : 17:42:28
|
| select date1 - date2 from tblwilll workOr was that not really the question==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
sabirpatel
Starting Member
22 Posts |
Posted - 2004-09-24 : 01:22:26
|
| Hi,DATEDIFF( ) Calculates an interval between two dates. eg.SELECT fname, lname, hire_dateFROM employeeWHERE DATEDIFF(year, hire_date, getdate()) > 5Locates all employees hired more than five years ago.Hope this answers your question.Regards Sabir Patelemail: sabirpatel@gmail.com |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-09-24 : 04:02:55
|
| Hooray! Someone else who likes to use the descriptive name for the first parameter in DATEDIFF / DATEADDKristen |
 |
|
|
|
|
|