SQL Server trigger to update the same table -


i have sql server table has varchar column can save 4 characters

when insert value 963 column have add leading "0" this
example:

  • if insert 23 value should saved 0023
  • if insert 236 value should save 0236
  • if insert 2369 value should saves 2369

can add after trigger table, check if value inserted less 4 digits, , update same value in column leading "0"s appended value

will affect performance of trigger? practice have trigger update value in same table?

yes, can create trigger , 1 operation did not affect performance.
way change value when use in select. e.g

select right('0000' + column, 4), .... 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -