# escaping underscores in a select statement

**URL:** <https://forum.kx.com/t/escaping-underscores-in-a-select-statement/8582>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [January 15, 2014, 4:03pm UTC](https://forum.kx.com/t/escaping-underscores-in-a-select-statement/8582 "2014-01-15T16:03:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdbrbs333](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kdbrbs333](https://forum.kx.com/u/kdbrbs333)\
**Post date:** [January 15, 2014, 4:03pm UTC](https://forum.kx.com/t/escaping-underscores-in-a-select-statement/8582/1 "2014-01-15T16:03:00Z")

</div>

I’m trying to select from a table, where the column names have underscores: i.e.

&nbsp;select underscore\_column from table

and i believe q doesn’t like this since \_ is reserved.&nbsp; How can I escape the \_ in the statement?

thanks,

---

<div class="post-metadata">

**Author:** ![manni\_patel](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@manni\_patel](https://forum.kx.com/u/manni_patel)\
**Post date:** [January 15, 2014, 4:32pm UTC](https://forum.kx.com/t/escaping-underscores-in-a-select-statement/8582/2 "2014-01-15T16:32:00Z")

</div>

\_ should be ok in a column name.. are you sure there isn’t anything else? Can you send a meta of the table?

---

<div class="post-metadata">

**Author:** ![manni\_patel](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@manni\_patel](https://forum.kx.com/u/manni_patel)\
**Post date:** [January 15, 2014, 4:34pm UTC](https://forum.kx.com/t/escaping-underscores-in-a-select-statement/8582/3 "2014-01-15T16:34:00Z")

</div>

EDIT: unless you meant the column name started with an \_ - that’s not allowed

If there is something dodgy about the column names you can always use functional select

http://code.kx.com/wiki/JB:QforMortals2/queries\_q\_sql#Functional\_Forms

---

<div class="post-metadata">

**Author:** ![kdbrbs333](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@kdbrbs333](https://forum.kx.com/u/kdbrbs333)\
**Post date:** [January 15, 2014, 4:56pm UTC](https://forum.kx.com/t/escaping-underscores-in-a-select-statement/8582/4 "2014-01-15T16:56:00Z")

</div>

Thanks you were right.&nbsp; I think the underlying table was splayed or partitioned.&nbsp; I assigned my result to a new local table, and was able to do the select.
