Re: VARCHAR: Working to design, but why?
Posted in 1998
Fred Prose wrote: > According to the SQL Reference manual: > > "When you store a VARCHAR calue in the database, only its defined characters > are stored. The database does not strip a VARCHAR object of any > user-entered trailing blanks, nor does the database server pad the VARCHAR > to the full length of the column." > > The question is, why would the design be that way -- ie. the trailing > blanks not stipped if the equivalent of "ABC " is entered. I've > never worked with a product that made that decision. > > A test case also showed that if you alter a table and change a column from > CHAR(20) to VARCHAR(20) you get the entire VARCHAR(20) padded. I think that server must not edit character data entered by user in any way and must store data "as-is". If you want to strip leading/trailing blanks you can TRIM string Leonid