Home > Archive > SQL Anywhere database > April 2005 > varchar to char









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author varchar to char
Einstein

2005-04-27, 8:24 pm

Hi All,

I am converting a varchar(20) column to char(30) and I expected that all my
data would be padded by spaces to fill up 30 length. However that didn't
hapen ? Also the new rows that I am adding which are less than 30 length
does not pad up ...what am I missing here ?

-TIA


David Kerber

2005-04-27, 8:24 pm

In article <426fea18$1@forums-2-dub>, NickEinstein@hotmail
.com says...
> Hi All,
>
> I am converting a varchar(20) column to char(30) and I expected that all my
> data would be padded by spaces to fill up 30 length. However that didn't
> hapen ? Also the new rows that I am adding which are less than 30 length
> does not pad up ...what am I missing here ?


Nothing except the fact that in ASA, char() and varchar() types work the
same, and neither one is padded with spaces.


--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
Breck Carter

2005-04-27, 8:24 pm

In addition to what David said, some *client interfaces*
treat the "char" and "varchar" datatypes differently,
although they are treated the same internally by ASA.

Also note that the dbinit -b option can be used to make ASA
ignore trailing blanks when performing comparisons. By
default, a difference in the number of trailing blanks would
cause two strings to be "not equal".

To force a column to be blank-padded, you could write a
before row insert/update trigger.

Breck

> Hi All,
>
> I am converting a varchar(20) column to char(30) and I
> expected that all my data would be padded by spaces to
> fill up 30 length. However that didn't hapen ? Also the
> new rows that I am adding which are less than 30 length
> does not pad up ...what am I missing here ?
>
> -TIA
>
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com