Jump to content

[SOLVED] can have dashs (-) in sql?


jesushax

Recommended Posts

hi all,

 

the top line is the echoed sql and the second line is the error from the sql

 

can i have dashes (-) in a statment? is that what the error is saying?

 

Thanks

 

INSERT INTO tblDirectory2 (Sect1-6, Sect1-1, Sect1-3, Sect1-4, Sect1-5, Sect1-7a, Sect1-7b, Sect1-7c, Sect1-7d, Sect1-8, Sect8-1, Sect1-2) VALUES ('', 'Limited Company', '', '', '', '', '', '', '', '', '0-5', '')

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-6, Sect1-1, Sect1-3, Sect1-4, Sect1-5, Sect1-7a, Sect1-7b, Sect1-7c, Sect1-7d, ' at line 1

Link to comment
https://forums.phpfreaks.com/topic/151031-solved-can-have-dashs-in-sql/
Share on other sites

I believe the answer is no, although it probably depends on the flavour of database; but you must have created a table with these column names in the first place for you to insert into it.

 

Did MySQL actually allow you to create a table with these column names? If so, then it shouldn't complain when you use them in SQL statements.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.