Search Postgresql Archives

Re: Changing boolean to a smallint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2010-11-04 15:41, Christine Penner wrote:
I have a table column I want to change from a boolean to a smallint. changing false to 0 and true to 1. How do I do that?

Christine Penner
Ingenious Software
250-352-9495
chris@xxxxxx

ALTER TABLE ALTER col_name TYPE SMALLINT
  USING CASE WHEN col_name THEN 1 ELSE 0 END;

--
Mail to my list address MUST be sent via the mailing list.
All other mail to my list address will bounce.


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux