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
 Old Forums
 CLOSED - General SQL Server
 CHAR column

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-08-07 : 13:59:02
Rudy writes "I have a column in my db which is char(40).
There are entries in this with the same text, but some come up with a length of 24 and some 25. This sugggests to me that there is a blank trailing space. Am I right?

However, if I update it to iteslf using a Rtrim, nothing changes.

Is is something to do with ANSI padding?

How can I get these entries to be identical, please?


Many thanks"

X002548
Not Just a Number

15586 Posts

Posted - 2006-08-07 : 14:26:40
where is the data coming from? my guess is an unprintable char

do this SELECT ASCII(SUBSTRING(Col,26,1)) and tell us what you get


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2006-08-07 : 15:59:14
Rudy,

If you defined the column as datatype CHAR(40), it will always be 40 characters long (even if there's nothing in it).

If you don't want it to have trailing spaces, use VarChar(40) instead.

Ken
Go to Top of Page
   

- Advertisement -