Re: Convert Char-->integer or Integer-->char
Posted in 2003
Topics: General Discussion
victor wrote:
> Hi Mark,
>
> I have tried, but I have an error 1213. I think I am wrong somewhere.
>
> Here is my tables :
>
> Tables textos :
> textos type
> codigo char(30)
>
> With codigo = 1, 15,20,34 etc...
>
> Table Lots :
> Lots type
> lot integer
>
> with lots.lot = 1,15,20,34 etc ...
>
> I need this "request"
> select textos.codigo from textos,lots where textos.codigo=lots.lot;> This don't work it is normaly because type is different
>
> So as you say I try this: select textos.codigo+0 from textos,lots where
> textos.codigo=lots.lot
> So I have an 1213 error --> A character to numeric conversion process
> failed.
>
> I try : select textos.codigo::INT from textos,lots where
> textos.codigo=lots.lot
> So I have an 201 error --> Syntaxe error as occurred
>
> Have you got an explication ??
Well all of that should work, so you must have non-numeric values in
textos.codigo. You could try filtering out any alpha values, but this all
goes to show up your database design deficiencies.
Cheers,
--
Mark.
+----------------------------------------------------------+-----------+
| Mark D. Stock mailto:mdstock@MydasSolutions.com |//////// /|
| Mydas Solutions Ltd http://MydasSolutions.com |///// / //|
| +-----------------------------------+//// / ///|
| |We value your comments, which have |/// / ////|
| |been recorded and automatically |// / /////|
| |emailed back to us for our records.|/ ////////|
+----------------------+-----------------------------------+-----------+
sending to informix-list
Mark D. Stock wrote: > victor wrote: > >> Have you got an explication ?? > > Well all of that should work, so you must have non-numeric values in > textos.codigo. You could try filtering out any alpha values, but this all > goes to show up your database design deficiencies. Don't hold back now, Mark, tell us exactly how you feel about bad database design... :o) -- "C'est pas parce qu'on n'a rien ''' dire qu'il faut fermer sa gueule" - Coluche