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
 General SQL Server Forums
 New to SQL Server Programming
 writing characters into table problem

Author  Topic 

christina_rules
Starting Member

23 Posts

Posted - 2007-05-26 : 04:41:07
i have declared an attribute with datatype char(20) in sql server 7. and i tried to write words into the table. when i read them for comparison, if the word is less than 20 characters, i have include whitespaces to make it exactly 20 characters to match. why is this? and how can i solve this problem?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-26 : 09:56:46
use varchar(20)
char adds trailing spaces to the end if the word is less than your specified length.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -