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
- Dozens more answers to tough SQL questions from Rudy Limeback.
- The Best SQL Web Links: tips, tutorials, scripts, and more.
- Have an SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
This was first published in January 2003