Are hyphens allowed in standard SQL column names?

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

    By submitting your registration information to SearchOracle.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchOracle.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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