SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
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  

AskSQLTeam
Ask SQLTeam Question

USA
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"

X002548
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


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

USA
391 Posts

Posted - 08/07/2006 :  15:59:14  Show Profile
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
  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.06 seconds. Powered By: Snitz Forums 2000