I would like to write a T-SQL statement that will examine a column of data and based on each record, make changes to the record.
The column is nvarchar and contains records that represent numbers from 1 to 1000.
For each number less than 1000, I want to add the correct number of leading zeros to produce a 4 digit number.
Exmaple: if the Number is 10, I would like to convert it to: 0010. If the number is 781, I would like to convert it to 0781.
How can I accomplish this using SET statements (without a cursor)?