# Create Table datetime syntax issue

**URL:** <https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813>\
**Category:** Ignition\
**Created:** [April 25, 2022, 2:42pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813 "2022-04-25T14:42:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![christopher.raphael](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@christopher.raphael](https://forum.inductiveautomation.com/u/christopher.raphael)\
**Post date:** [April 25, 2022, 2:42pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/1 "2022-04-25T14:42:04Z")

</div>

How does a datetime need to be put in to Create a Table with script. This is my script but it hates the datetime setup.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/8/28c06f8fa5ec44f85566d4eb317a73926de237e6.png)

I would also like to auto generate folders and tags in the default tag database using script. Any examples would help. My project is going out to several plants and I am doing code to auto generate all the items they need to make the project work.

---

<div class="post-metadata">

**Author:** ![ajdewhirst1](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@ajdewhirst1](https://forum.inductiveautomation.com/u/ajdewhirst1)\
**Post date:** [April 25, 2022, 2:51pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/2 "2022-04-25T14:51:37Z")

</div>

Try delete the first open parenthesis, then move the last triple quotes to the right of the close parenthesis, like this:

```auto
qry = """Create Table JSU_HeaderInfos(
column1 datatype1,
column2 datatype2,
...
columnN datatypeN)"""

```

---

<div class="post-metadata">

**Author:** ![christopher.raphael](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@christopher.raphael](https://forum.inductiveautomation.com/u/christopher.raphael)\
**Post date:** [April 25, 2022, 3:03pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/3 "2022-04-25T15:03:31Z")

</div>

The actual query setup works but using datetime or date does not make the query happy. The rest of it works when omitting t\_stamp.

---

<div class="post-metadata">

**Author:** ![ajdewhirst1](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@ajdewhirst1](https://forum.inductiveautomation.com/u/ajdewhirst1)\
**Post date:** [April 25, 2022, 3:06pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/4 "2022-04-25T15:06:45Z")

</div>

Is this MSSQL?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 25, 2022, 3:07pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/5 "2022-04-25T15:07:33Z")

</div>

What flavor of DB are you using?

---

<div class="post-metadata">

**Author:** ![christopher.raphael](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@christopher.raphael](https://forum.inductiveautomation.com/u/christopher.raphael)\
**Post date:** [April 25, 2022, 3:11pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/6 "2022-04-25T15:11:52Z")

</div>

It is MSSQL.

---

<div class="post-metadata">

**Author:** ![christopher.raphael](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@christopher.raphael](https://forum.inductiveautomation.com/u/christopher.raphael)\
**Post date:** [April 25, 2022, 3:14pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/7 "2022-04-25T15:14:41Z")

</div>

So I figured out the issue creating the table but i still need help creating and adding folders and tags using script to the default tag db.

---

<div class="post-metadata">

**Author:** ![ajdewhirst1](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@ajdewhirst1](https://forum.inductiveautomation.com/u/ajdewhirst1)\
**Post date:** [April 25, 2022, 3:18pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/8 "2022-04-25T15:18:41Z")

</div>

Glad you fixed it. Please share what the resolution was 🙂

---

<div class="post-metadata">

**Author:** ![christopher.raphael](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@christopher.raphael](https://forum.inductiveautomation.com/u/christopher.raphael)\
**Post date:** [April 25, 2022, 3:33pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/9 "2022-04-25T15:33:56Z")

</div>

Missing parenthesis at the end and the quotes needed moved outside of the first set.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/f/ff1991c0210fef9680af029d8c34593e6a962cf6.png)

Still need to figure out using script to create tags and folders in the tag database though.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 25, 2022, 6:37pm UTC](https://forum.inductiveautomation.com/t/create-table-datetime-syntax-issue/58813/10 "2022-04-25T18:37:01Z")

</div>

> [@christopher.raphael](#):
>
> Missing parenthesis at the end and the quotes needed moved outside of the first set.

That's exactly what @ajdewhirst1 told you to do ! hint: You don't need the outer parentheses.
