Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 VARCHAR datatype size - data padded with blanks

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-08 : 09:47:05
Jyothi writes "Hi,
My problem is somewhat like this......
I insert data into a column of datatype VARCHAR , size 50. However the length of this data is say 10. It goes in to the table with trailing blank spaces padded till length of data becomes 50.
As a result when this data is retreived, the retreived data has trailing blank spaces in it. This gives problems later for validations.
Pls. tell me if it b'coz of SQL Server or b'coz of the driver used i.e jdbc:odbc.
Please reply soon.
Thanks.
Jyothi."

andre
Constraint Violating Yak Guru

259 Posts

Posted - 2002-05-08 : 09:58:58
You might want to check the length of the fields in the database using the string function LEN in Query Analyzer. That will tell you if the problem is in SQL Server.

Using the LTRIM or RTRIM will remove the extra spacing if there are extra spaces in the fields.



Edited by - andre on 05/08/2002 10:01:44
Go to Top of Page

dsdeming

479 Posts

Posted - 2002-05-08 : 13:26:17
If the column is defined as varchar and the parameter is defined as varchar, the only way you'll get training blanks into the column is if you ( or the driver ) add them to the parameter.

Go to Top of Page
   

- Advertisement -