I currently have a column in a table with data type char and length 500. However, not every column fills up the entire 500 length, and I would like to fill up the rest of the spaces with dots. Is there a setting in SQL to do this? I do not want to use varchar since I want a fixed length with dots at the end. Any ideas?
Thanks,
Alan
I can't really imagine why you would have that requirement, it is kinda backwards.
If your goal is to display the data padded with dots up to a total length of 500, then I'd suggest that you do use a varchar for storage of your data (without dots).
When you want to retrieve it, then you pad it. Something like this;
create table #x (mystring varchar(50) not null)
insert #x
select 'abc' union all
select 'defgh'
select mystring + replicate('.', 50 - len(mystring))
from #x
drop table #x
go
abc...............................................
defgh.............................................
Would that work as an idea for you?
/Kenneth
No comments:
Post a Comment