Jump to content

Archived

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

csamuels

sql insert into syntax errors 1064

Recommended Posts

i don't understand why im getting these syntax errors

 

 

index column is varchar(100)

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]

Error running query

insert into persinfo set agtname='agtname',keyperson='key person1',title='title',hiredate='01-01-2005',yearsinforce='50',prof_desg='prof desg',lic_num='12345-1245',index='12a538f190e79b6f3806965c93318bc1'

 

1064: 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 'index='12a538f190e79b6f3806965c93318bc1'' at line 1

 

 

 

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]

Error running query

insert into automation set manage_sys='1',manage_name='vendor',purchased='01-01-2005',software='software name',version='version',functions='accounting,word processing,Sales Aids,client policy information,applications,claims,rate/quote,other,',functions_other='other reason',if='1',if_reason='pl,cl,claims/other,auto,bop,ho,contractors,umb,smp,commerical umbrella,',if_function='if reason',commitment='commit',if_percent='20%',auto_manager='1',auto_who='auto reason',auto_who1='auto who',agtname='agtname'

 

1064: 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 'if='1',if_reason='pl,cl,claims/other,auto,bop,ho,contractors,umb,smp,commerical ' at line 1

 

 

 

but these do execute

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]

query executed

insert into info set agtname='agtname',mail_address='mail address',mail_county='mail county',mail_city='mail city',mail_state='mail state',mail_zip='12452-4521',phone='phone',fax='fax',fedid='12345-1245',email='email',phy_address='phy address',phy_county='phy county',phy_city='phy city',phy_state='phy state'

 

query executed

insert into principals set agtname='agtname',name='prince name',title='title',dob='06/26/83',yearsagy='200'

Share this post


Link to post
Share on other sites

index and if are reserved words of mysql. you can get away with using some reserved words as column names like 'date', but most other reserved words are not being parsed correctly when used as column names. backtick them: `index`='value' `if`='value' or avoid using reserved words as column names.

Share this post


Link to post
Share on other sites

×

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.