# Create a sql table script

**URL:** <https://forum.inductiveautomation.com/t/create-a-sql-table-script/6990>\
**Category:** Ignition\
**Created:** [August 6, 2013, 2:19pm UTC](https://forum.inductiveautomation.com/t/create-a-sql-table-script/6990 "2013-08-06T14:19:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AJBerera](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@AJBerera](https://forum.inductiveautomation.com/u/AJBerera)\
**Post date:** [August 6, 2013, 2:19pm UTC](https://forum.inductiveautomation.com/t/create-a-sql-table-script/6990/1 "2013-08-06T14:19:19Z")

</div>

I would like to create a table using an event driven script so that I might make future installations require only the Ignition backup instead of restoring irrelevant data to my fresh databases.  
So I want to have a way of creating the skeleton for the tables I will need associated with a project backup so I won’t have to enter the database management.

I want something like this

`system.db.runQuery(CREATE TABLE example (id INT IDENTITY (1,1),
name VARCHAR(55) NOT NULL,timestamp datetime NOT NULL);)`

Or if anyone knows a better way to manage creating tables. Lets hear it.

---

<div class="post-metadata">

**Author:** ![Micky.Franks](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Micky.Franks](https://forum.inductiveautomation.com/u/Micky.Franks)\
**Post date:** [August 6, 2013, 6:59pm UTC](https://forum.inductiveautomation.com/t/create-a-sql-table-script/6990/2 "2013-08-06T18:59:49Z")

</div>

Don’t know if this helps or not. What I have done for moving a projects SQL data from one computer to another was doing a backup or dump of the sql database and then just open it in notepad then copy/paste it into the SQL query browser in Igniton and execute it.

---

<div class="post-metadata">

**Author:** ![AJBerera](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@AJBerera](https://forum.inductiveautomation.com/u/AJBerera)\
**Post date:** [August 6, 2013, 7:15pm UTC](https://forum.inductiveautomation.com/t/create-a-sql-table-script/6990/3 "2013-08-06T19:15:34Z")

</div>

Thanks Mickey.  
I was also considering using a folder of transaction groups with create table enabled and insert nulls to create the columns I need and then enable and then disable them after my tables were created but I was looking for a more elegant scripted solution.
