@Kkoruni I've added an example of use with
try_cast
. Garbage was stored in Sales because the data type of varchar(20)
allowed it. To avoid this, use the most restrictive and appropriate data type and constraints so you know for sure what's stored in the column. This issue is known as "data integrity". Sloppy data makes everything harder.