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-08-06 : 09:30:52
|
| manoj writes "can we define own function?i have to make function for calculating date difference between two dates excluding satuaday and sunday in MS-SQL SERVER 7.0.how is the procedure in sql server.i am trying in opening new stored procedure window and wring like CREATE FUNCTION. but i m getting error near FUNCTION.please send me solution ASAP.Thanx,manoj" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-08-06 : 09:32:49
|
| User-defined functions are only available in SQL Server 2000.But, you can use the DateDiff function to get the results you need:SELECT DateDiff(dd, @date1, @date2) - (DateDiff(wk, @date1, @date2) * 2)And I'm pretty sure Arnold has a more accurate version of this somewhere, but I can't find it in the forum search.Edited by - robvolk on 08/06/2002 09:33:26 |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
|
|
|
|
|