I’m not sure if this should be a constraint or not, but I want the ‘UserName’ column of a table to ignore the value that is set when an insert or update is executed and instead, store the value of ‘DisplayUserName’ column converted to lowercase. And if ‘DisplayUserName’ is changed, ‘UserName’ should be updated as well to ‘DisplayUserName’ lowered.
Thanks!
The common way of doing this is using a trigger that fires on insert and update.
http://msdn.microsoft.com/en-us/magazine/cc164047.aspx
The code for the trigger should be something like this:
Just adjust it to your specific business rule, because I think I didn’t got it right =)