I'm wondering how to set an nchar
column to null with an update statement. I found this: NULL value for int in Update statement
which says you have to cast to set non-int fields to NULL
.
So I tried the following:
commandText =
@"UPDATE Brukere
SET Engangskode = CAST(NULL AS NCHAR)
WHERE Navn = @navn AND Mobilnr = @mobilnr";
However, when I execute this it still won't update the column to NULL
. Am I casting wrong, or is it something else? Any help would be appreciated :)
Longer code snip if needed: http://pastebin.com/8auKuk6Q