December 13, 2007 at 7:17 am
Hi,
I'm trying to create a persisted computed column using the hashbyte function. But when adding this column to my table I get a error message which says:
Computed column 'check' in table 'tbl_cons' cannot be persisted because the column is non-deterministic.
My Alter Statement looks like this: Alter TAble tbl_cons Add [check] AS (hashbytes('md5', isnull ([TICKER] ,'') + isnull ( convert(nvarchar, CPN) ,'') + ... )
It builds a hash out of ca. 200 columns. AFAIK hashbytes is non-deterministic for NULL values, but as I'm using isnull() this can never happen.
Before hashbytes I used checksum, but there have been changes on the underlying columns which didn't change the checksum.
Any chance to make this column persisting?
Regards,
Jan
December 13, 2007 at 8:16 am
Something else is making it non-deterministic. I just tried using hashbytes of a single column in a persisted computed column, and it does work. Check for any other calls that might make it non-deterministic.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
December 13, 2007 at 8:55 am
Hi Matt,
thanks for that hint, it seems that I'm getting this error if one of the used columns is datetime, although it is converted into nvarchar.
I'll try to find an workaround and post it.
Regards,
Jan
December 13, 2007 at 9:06 am
Keep in mind that getdate() is non-deterministic, so that if it happens to be using that your result will forever be non-deterministic.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
December 13, 2007 at 9:29 am
Hi,
it seems that this error only occurs by converting datetime columns into a style which contains spaces. Using 126 as style (also tried 101 - 105) works fine, while using 106 produces this error message.
Update: This works, but it isn't possible to replicate this column because sql server says it is non-deterministic. I think this is a bug on SQL Server 2005, what do you guys think?
Regards,
Jan
July 25, 2013 at 5:47 pm
This issue is resolved by installing SP1:
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply