Your question: Are dashes allowed in SQL?

How do I add a dash to a string in SQL?

To set a string with hyphen and numbers, you need to use single quotes. For example, ‘Customer-1234-899’, ‘Customer-9383-901’, etc.

What characters are allowed in SQL?

Names can contain (but cannot begin with) the following special characters: 0 through 9, #, @, and $. Names specified as delimited identifiers (in double quotes) can contain additional special characters.

Can varchar have hyphen?

what data type in SQL Server would allow me to use numbers and dashes (101-07, and stuff like that) in the field. Then you have to use a varchar = none numeric data type to store numeric with dashes.

All replies.

Alankar Chakravorty
Joined Dec 2009
1 9 Alankar Chakravorty’s threads Show activity

Can MySQL table name contains hyphen?

No, you won’t get any issues with underscores in a MySQL table name. You will get the issues with a dash in a MySQL table name.

How do I replace multiple characters in a string in SQL Server?

If you use SQL Server 2017 or 2019 you can use the TRANSLATE function. In this example de pipe, plus, comma en minus are all replaced by an underscore. You can change every character with its own one. So in the next example the plus and minus are replaced by a hash.

THIS IS IMPORTANT:  Best answer: Where are jQuery files stored?

Which characters are not allowed in SQL?

SQL Server reserves both the uppercase and lowercase versions of reserved words. Embedded spaces or special characters are not allowed. Supplementary characters are not allowed.

What are invalid characters in SQL?

The message, described as an invalid character error, typically is the result of a common syntax mistake. The cause, according to Oracle docs, can be from starting identifiers with ASCII (American Standard Code) that are not letters or numbers.

What does a hyphen do in SQL?

The double hyphen places a single-line comment in a SQL*Plus script. The double hyphen works the same way as REMARK, except that it may be used in SQL statements and PL/SQL blocks. When used in a SQL statement or PL/SQL block, the double hyphen may be used to add trailing comments to a line.

What data type is a hyphen?

1 Answer. With hyphens, it’s a string, full stop!

What data type is dash?

When dealing with numbers, a dash usually means negative. Is that all you’re trying to deal with is negative numbers? Thanks Guys.

Can a table name start with underscore?

Underscores are perfectly legal in table names.