Page 1 of 1

Inserting number into CHAR field

Posted: Wed Jan 21, 1998 4:05 pm
by Thunderstone


Hello,

A table field that is defined as char(8) and a variable that has always
held a number. Upon doing an insert the table field is empty. How can I
convert the int var to a string so I can insert it into the field?

-rob out




Inserting number into CHAR field

Posted: Wed Jan 21, 1998 4:51 pm
by Thunderstone



I'm not sure where you are finding a field with a definition of char(8)
in Webinator, however variables can be converted with a convert call, for
example:

<$x=(convert($y, 'varchar' ))>

The reason it does not work is that char(8) is not large enough to hold
the largest number that a variable could hold, so the direct assignment
will not work.



Inserting number into CHAR field

Posted: Wed Jan 21, 1998 11:34 pm
by Thunderstone



If the context you are asking this question in is within
Texis web script (vortex) and the variable is a CGI var:

<sum "%s" $IntVar>
<$StringVar=$ret>
<sql "insert into mytable values ($NowAString)">


tsql "insert into mytable values ('1')"