Обсуждение: Re: [SQL] Typecasting within sql statement.
Try something like this: update myTable set field = 42::text::varchar; I think the int4 --> text converter is written, and text --> varchar is written, but int4 --> varchar is not. Basically, anytime you need to go from one type to another that doesn't seem to have a converter, look for a more general intermediate type. At least, that's my understanding after one fight with this. :-) -- -- -- "TANSTAAFL" Rich lynch@lscorp.com
> update myTable set field = 42::text::varchar; > > I think the int4 --> text converter is written, and text --> varchar is > written, but int4 --> varchar is not. Well, It seems you understand what I am looking for but this did not work. I get an error of: WARN:parser: parse error at or near "::" Do you think my fastest solution would be to write a func (inttochar) which accepts and int and returns a char. Should only take a minute. I think that is what I will do. Thanks for your help. If anyone else knows an easier solution, let me know and I will dump my function. Have a good weekend. -- Colin Dick On Call Internet Services cdick@mail.ocis.net