jesushax Posted March 25, 2009 Share Posted March 25, 2009 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 Quote Link to comment Share on other sites More sharing options...
Yesideez Posted March 25, 2009 Share Posted March 25, 2009 I'd prefer to use underscore. Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted March 25, 2009 Share Posted March 25, 2009 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. Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 25, 2009 Share Posted March 25, 2009 Put the column names in `` Quote Link to comment Share on other sites More sharing options...
Yesideez Posted March 25, 2009 Share Posted March 25, 2009 Why didn't I think of that, Mchl? Quote Link to comment Share on other sites More sharing options...
jesushax Posted March 25, 2009 Author Share Posted March 25, 2009 what does the ` do? Quote Link to comment Share on other sites More sharing options...
kickstart Posted March 25, 2009 Share Posted March 25, 2009 Hi It delimits column names that would otherwise cause issues. Such as those containing spaces or those which are an SQL reserved word. All the best Keith Quote Link to comment Share on other sites More sharing options...
jesushax Posted March 25, 2009 Author Share Posted March 25, 2009 thanks alot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.