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 |
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2010-09-28 : 10:21:09
|
| Hello everyoneI want to use the DateDiff function within a UDFfor exampleselect DateDiff (day, INVDATE , getdate()) from customer_statement_PB where ( "the difference is more than 50" )what is the syntax to implement the >50 criteria.Kind RegardsRobMCTS / MCITP certified |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-09-28 : 10:54:15
|
| Are you using sql server 2000 or 2005 ?AFAIK in Sql 2K you cannot use getdate() (non-deterministic function) inside UDF. You need to pass as parameter.In Sql 2K5 I feel we can use getdate() function.The select will be:select DateDiff (day, INVDATE , getdate()) from customer_statement_PB where DateDiff (day, INVDATE , getdate()) > 50 |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2010-09-28 : 11:05:19
|
| Hello thereyeah sql server 2005 |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2010-09-28 : 11:17:38
|
| how would i tie this into a column constraint? |
 |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-09-28 : 11:32:45
|
quote: Originally posted by masterdineen how would i tie this into a column constraint?
what you mean by "tie this into a column constraint".You don't want user to enter the data older than 50 days ? |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2010-09-28 : 11:36:03
|
| No I just want to have a column, for example stating how many days over dueworking off a datediff from datetime column. |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2010-09-29 : 04:13:58
|
| Good morning everyone, does anyone have any ideas on this on please? |
 |
|
|
|
|
|