# Help with SQL (or other) code to change Column Type

**URL:** <https://forum.xojo.com/t/help-with-sql-or-other-code-to-change-column-type/15532>\
**Category:** Databases\
**Created:** [April 6, 2014, 7:32pm UTC](https://forum.xojo.com/t/help-with-sql-or-other-code-to-change-column-type/15532 "2014-04-06T19:32:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Seyfarth](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/d26b3c/32.png) [@Tim\_Seyfarth](https://forum.xojo.com/u/Tim_Seyfarth)\
**Post date:** [April 6, 2014, 7:32pm UTC](https://forum.xojo.com/t/help-with-sql-or-other-code-to-change-column-type/15532/1 "2014-04-06T19:32:09Z")

</div>

Hello all,

I had used a column type of REAL in a SQLite database. Can anyone give me an idea how to change the Column Type from Real to CHAR?

Thanks all,  
Tim

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [April 6, 2014, 8:31pm UTC](https://forum.xojo.com/t/help-with-sql-or-other-code-to-change-column-type/15532/2 "2014-04-06T20:31:13Z")

</div>

you want to jet copy the data to a temporary one, drop & recreate the table with whatever changed column definitions you need then copy the database

select \* into tempTable from currentTable  
drop table currentTable  
create table currentTable (columns definitions in the same order but new types)  
insert into currentTable select \* from tempTable

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:09pm UTC](https://forum.xojo.com/t/help-with-sql-or-other-code-to-change-column-type/15532/3 "2020-10-29T17:09:42Z")

</div>


