My SQL Server table has a column defined as:
TicketNo varchar(5)
The rows in this table are inserted by some bulk load files from different sources.
Now, depending on who prepared the bulk load input files, sometimes TicketNo has leading 0s, sometimes not.
How can I enforce INSERTS to the table so that TicketNo will always be set with leading zeros, something like:
TicketNo = RIGHT('00000'+TicketNo, 5)
insert into table (ticketno,...) values (RIGHT('00000'+@TicketNo, 5),...);?