« Does q have closures? | Main | What does 'NUC mean? »

Why doesn't 'select from tablename where name = `ABC/A' work?

When using symbols that have special characters embedded in them, you need to use a string and cast it to a symbol.

In the example in the question, the / is interpreted as the q adverb over:

q)`ABC/A / interpreted as `ABC over A.
'/

The '/ error means we have misapplied /. Here's how to create the symbol we want:

q)`$ "ABC/A"
`ABC/A
q)select from tablename where name = `$ "ABC/A"

Finally, symbols with embedded spaces are allowed, as long they are not leading or trailing:

q)`$" ABC E "
`ABC E
q)string `$" ABC E "
"ABC E"
q)

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Textile formatting is allowed.