I’m not sure if this should be a limitation or not, but I want the “UserName” column of the table to ignore the value set when performing the insert or update, instead save the “DisplayUserName” value converted to lowercase. And if "DisplayUserName" is changed, "UserName" should also be updated to "DisplayUserName".
Thanks!
A common way to do this is to use a trigger that fires when you insert and update.
http://msdn.microsoft.com/en-us/magazine/cc164047.aspx
The trigger code should look something like this:
CREATE TRIGGER updateDisplayName_trigger ON Users FOR INSERT, UPDATE AS IF UPDATE(UserName) UPDATE Users SET DisplayUserName = Lower(UserName)
-, , =)
, . - :
CREATE TABLE [dbo].[SampleTable]( [ID] [int] IDENTITY(1, 1) NOT NULL, [DisplayUserName] [varchar](100) NOT NULL, [UserName] AS (lower([DisplayUserName])) ) ON [PRIMARY]
, UserName, DisplayUserName.
You will need to create a trigger to handle the update.
Source: https://habr.com/ru/post/1704621/More articles:On Mac OSX 10.5, it cannot find my terminal commands sudo, find, etc. - terminalASP MVC folder hierarchy - asp.netclearing missed geocoding (or general guidelines for clearing data) - geocodingChanging the structure of WordPress URLs when working with 301 redirects using mod_rewrite - phpPowershell Addition - syntaxCMake compilation error .. (Unknown CMake command "QT4_WRAP_UI") - cmakeКакие из этих функций браузера Javascript работают лучше? - performanceHow does MySQL use index mappings? - mysqlDjango: the uploaded file is locked. Unable to rename - pythonIs a method / variable reference in the external namespace more memory efficient than including it completely? - c #All Articles