I have a table which fills out the rows I have put in there with spaces if the thing I put in there isn’t long enough.
For example:
I have a string called
'ABC'
but the column is a nchar(10)
so the value which is put in there becomes
'ABC '
Does anyone know what the problem could be?
I am working in MSSQL.
ncharis a fixed width datatype and will always be padded out with spaces up to the defined column limit. You would neednvarchar(10)to avoid this.You should generally only use
ncharin preference tonvarcharwhen the values in the column all have the same or very similar lengths.