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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 CHAR column
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

0 Posts

Posted - 08/07/2006 :  13:59:02  Show Profile  Visit AskSQLTeam's Homepage
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"

Not Just a Number

15586 Posts

Posted - 08/07/2006 :  14:26:40  Show Profile
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



Hint: Want your questions answered fast? Follow the direction in this link

Add yourself!
Go to Top of Page

Constraint Violating Yak Guru

391 Posts

Posted - 08/07/2006 :  15:59:14  Show Profile

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.

Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000