How to make a trigger that would filter data by the type one is uppercase, the rest lowercase (Uppercase)?

Hello. How to make the trigger T-sql or MS SQL to filtered when entering data.
an example of this is the "BOB" => "Bob", as if not entered, it will always be "Bob"
The table dbo.Person here my field

In mysql I was doing this (fields, name, lastname, surname).
June 5th 19 at 21:00
2 answers
June 5th 19 at 21:02
And why for such a trigger?
Normal variant - conversion on insert and update.
Ideal - in the form of a call to a stored procedure that writes data Preobrazhenie.

Well momentik: there is a famous literary character Jim Digriz - he would not appreciate the mockery of his name)
Ideal - in the form of a call to a stored procedure that writes data Preobrazhenie.

How? In the words of every much) - turner.Hans commented on June 5th 19 at 21:05
Well, usually in words - means that sapienti sat)

create procedure dbo.insert_or_update_illustration @id int out, @text nvarchar(max)
with encryption as 

set @text = upper(substring(@text,1,1))+lower(substring(@text,2,len(@text)-1))

if @id is null begin -- create 
 -- calculate new id (or use the identity)
 insert into table (id, text) values (@id,@text)
 - if identity - last id produced 
end else begin -- update
 update table set text=@text where id=@id

Well, I recommend to experiment with capitalization of the first letters for example Leonardo da Vinci - delta89 commented on June 5th 19 at 21:08
Well ahead of the course - as a hint:
set @text = can grow in large enough design that will cope with large family consoles the exception of the capitalization of the "von", "der", "de" and other untypical variations of capitalization, spelling of names and surnames, including if necessary, the logic of discarding of GTA V on garage door on the subject "man with a name, date of birth, address and VAT is already in the database" - delta89 commented on June 5th 19 at 21:11
Thank you very much , have to move)). Another little advice is needed. To my database I am doing an interface to manage it. Such testing procedures better to do on the side of the database(sql) or on the side of the interface( e.g. C#)? That is to make all the checks in C# and in database will INSERTиться just data - turner.Hans commented on June 5th 19 at 21:14
well, you can build on a similar concept of "face" has information only about the current context and no more, and on the side of the sql - everything else.

That is, all the logical checks, validity, permissibility, right - side sql, and front end General validation of the "name must be specified", "the phone number must be 10 digits", etc.

This will give another plus when new aspects of the new inspection and editing will take 3-4 treatments (if you focus on Create/Read/Update/Delete, or CreateOrUpdate/Read/Delete

Well triggers - convenient for example when logging (though there is romantici for bulk operations) - delta89 commented on June 5th 19 at 21:17
June 5th 19 at 21:04

Find more questions by tags SQL ServerC#Transact-SQL