<p>In the tradition of <a href="https://stackoverflow.com/questions/309492/user-defined-functions-sql-server-2005-flagged-incorrectly-as-non-deterministic">this question</a> and in light of <a href="http://msdn.microsoft.com/en-us/library/ms178091(SQL.90).aspx" rel="nofollow noreferrer">the documentation</a>, how does one make this function deterministic:</p>

<pre><code>ALTER FUNCTION [udf_DateTimeFromDataDtID]
(
    @DATA_DT_ID int -- In form YYYYMMDD
)
RETURNS datetime
WITH SCHEMABINDING
AS
BEGIN
    RETURN CONVERT(datetime, CONVERT(varchar, @DATA_DT_ID))
END
</code></pre>

<p>Or this one (because of the string/date literals - and yes, I've also tried '1900-01-01'):</p>

<pre><code>ALTER FUNCTION udf_CappedDate
(
    @DateTimeIn datetime
)
RETURNS datetime
WITH SCHEMABINDING
AS
BEGIN
    IF @DateTimeIn &lt; '1/1/1900'
        RETURN '1/1/1900'
    ELSE IF @DateTimeIn &gt; '1/1/2100'
        RETURN '1/1/2100'

    RETURN @DateTimeIn
END
</code></pre>

From the articles you linked:
To be deterministic, the style parameter must be a constant. Additionally, styles less than or equal to 100 are nondeterministic, except for styles 20 and 21. Styles greater than 100 are deterministic, except for styles 106, 107, 109 and 113.
You need to use a style parameter in your conversions to datetime.
For example:
```
```
CONVERT(datetime, '2008-01-01', 121)
```
```
Except don't use 121...