Can a table field contain a hyphen?

Solution 1:

Yes, you can use punctuation, white space, international characters, and SQL reserved words if you use delimited identifiers:

SELECT * FROM `my-table`;

In MySQL, use the back-ticks. In standard SQL, use double-quotes.

Or if you use MySQL you can set the ANSI_QUOTES SQL mode:

SET SQL_MODE = ANSI_QUOTES;
SELECT * FROM "my-table";

Solution 2:

Try putting brackets on the last part of your call on the table. in your case:

SELECT * FROM [TABLE-NAME];

just make sure to put the brackets on the table name only. not on the whole database it is located

SELECT * FROM some_database.anotherdatabase.[your-table];

P.S. works on columns, too.

I'm using Microsoft SQL Server Management.