Many times, i have been troubled in scenario where the Current system Date cannot be referred using GETDATEI) within the User Defined Functions.  This is obviously the non-deterministic nature of GETDATE() function and User defined functions do not allo their usage.  Here is a tip i followed earlier which worked pretty well to overcome this constraint.

1. Create a view as following

2. you can now use this view, which always returns one record within the User defined functions by referring to the columns of the CurrentDate view.

This seems to be a “hack” and it is supported up to SQL 2K8.

Any other better ideas will be appreciated :) .



Sriram Subramanyan

Like us on FaceBook Follow us on Twitter

Join the fastest growing SQL Server group on FaceBook