问题
So that when you insert 'abc',it'll be converted to 'ABC' automatically.
I'm using MySQL,is it possible?
回答1:
You could write an INSERT trigger that does this for you.
Something like:
CREATE TRIGGER Capitalize BEFORE INSERT ON MyTable
SET NEW.MyColumn = UPPER(NEW.MyColumn)
回答2:
What about using Upper function while executing query ? lets say You are using a SP to insert the values ... cast the value to upper case using UPPER function and then insert ?
回答3:
this really should be done before it is passed to the DB
来源:https://stackoverflow.com/questions/2056488/how-to-define-a-column-that-can-automate-capitalizing