Not sure how to start describing this so I get straight to it.
I have a SQL Server 2012 database with a sample table Table_1 with the below (simplified) design:
id: int (PK, ID, NOT NULL)
name: varchar(100) (NOT NULL)
label: varchar(100) (NOT NULL)
description: varchar(max) (NOT NULL)
on my front end form user is asked for a name and description only.
What I want to achieve from the database is to, at the point of creating new record, get the value of the name field, convert it to lowercase and replace any spaces with underscores, and then insert the resulting string into the label column.
For example if user provided name "Sample Product", I want the label to be "sample_product".
How can I achieve this and what is the best approach: triggers or the calculated field property can do this?
Thanks in advance for any help or pointers.