|
I'm using SQL 2008 (not R2). When I try to define the following UDF and try to use it in a computed column, I get the ever popular "cannot be persisted because the column is non-deterministic". using I've even replaced the body of the UDF with a simple I am simply not seeing what is non-deterministic. Any help would be apprectiated.
(comments are locked)
|
|
You need to add the That has solved the issue. I'd seen it in other posts but discounted it since the UDF access no tables. I suppose an algorithm to truly determine determinism wouldn't be the easiest to implement.
Sep 20 '11 at 08:54 AM
RussellNCook
(comments are locked)
|


A bit of follow-up. A shortened version of the table this will be used with is the following.
create table t ( id int identity(1,1), firstname nvarchar(100) )
I'm then adding the computed column as:
alter table t add firstnamesearch as dbo.RemoveNonAlphanumeric( firstname ) persisted;
I get that the computed column fails with the "non-deterministic" error message since the UDF itself says it's not deterministic. Hence the focus on figuring out the issue with the UDF especially when it's hard-coded to return the same value regardless of what it's inputs are.