[postgis-users] convert integer to varchar

Gregory Williamson Gregory.Williamson at digitalglobe.com
Sun May 25 16:51:47 PDT 2008


Bui Anh Tin shaped the aether and said:

> 
>  SELECT ( '../admin.aspx?com=addmap&type=edit&id=' ,mapid) as edit form
> mytable
> 
> mapid is interger
> but it error
>

It helps if you include the version of PostGreSQL that you are running (select version() at a psql prompt will tell you); I suspect that this is 8.3.x because it has gotten rid of some implicit casts, especially where numbers are concerned.

You might try:

 SELECT ( '../admin.aspx?com=addmap&type=edit&id=' || mapid::text)

This is untested as the SQL you provide is not the SQL you ran -- "as edit form" is probably "AS edit FROM" -- not the transposed letters in the last word. It helps if you can actually quote exactly what you did since an accidentally introduced typo can break an SQL statement.

I am guessing you want to append the mapid value to a string -- "||" is one concatenation operator.

HTH,

Greg Williamson
Senior DBA
DigitalGlobe

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information and must be protected in accordance with those provisions. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

(My corporate masters made me say this.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080525/a119ac87/attachment.html>


More information about the postgis-users mailing list