You can use them as fixed-type string data types, as in:
select cast(customerID as char(10)) as customerID, cast(mobilenumber as char(11)) as mobilenumber, cast(Emailaddress as char(256)) as Emailaddress from customer
If you encounter any oddities when working like this, it may be useful to save the ANSI_PADDING settings.
Another way to do this might be:
select left(Emailaddress + replicate(' ', 256), 256)
Although this method often simply applies similar logic from other languages ββto T-SQL.
source share