Ask the Expert

Are hyphens allowed in standard SQL column names?

ODBC specifications are a superset of the ISO/ANSI SQL specifications. I need to know if the use of hyphens when naming columns is disallowed under these standards. I've checked the ANSI SQL92 specification with little luck.

    Requires Free Membership to View

You have a copy of the ANSI standard? (Not me. Don't they charge a few hundred bucks a copy?) Was the ANSI standard not clear about which characters are allowed? Sheesh!

One thing you could do, when in doubt about a particular nuance of the SQL standard, is to run your SQL through the Mimer SQL Validator. There are three versions: SQL-92, SQL-99, and SQL-200x.

Mimer, in case you were not aware, is the name of a relational database system marketed by a company called Upright Database Technology AB. Hopefully they will not object to the increase in Web traffic that comes their way as a result of this mention of their SQL Validators. (Who knows, they may end up with a new customer that way.) I personally have never had the opportunity to work with the Mimer database, but you can tell the company has a lot on the ball, not least by the fact that they offer a service like their SQL validators on the Web. A big kudos to them.

Anyhow, to answer your question, according to the Mimer Validator, hyphens are not allowed in column names in SQL-92.

For More Information

This was first published in January 2003

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: