I’m using the database (sql server) of an old program, and want to make batch inserts on the SUPPLIERS table which key is varchar(10). The thing is that the old program fills the key with leading blankspaces to complete the 10 characters, example (underscore represents blankspace)
=’_______310′, ‘_______311’…, ‘______1000’.
I’ve tried to convert the value to char(10) but it adds the blankspaces at the trail. I’ve also tried to use space function, but the problem is that for key 310, I’ve to add 7 blankspaces, but for the key 1000, 6, so making this function dynamic on a simple select or insert statement would be very messy.
Without those spaces this app will not work porperly, so do you have any idea of how to add this spaces on a simple select or insert statement?
Thanks