I am getting the following error when performing an insert into a MySQL
table

 

You have an error in your SQL syntax; ... right syntax to use near 

'  0  ) ,  (  3 ,  1 ,  'South Dakota' ,  'SD' ,   ,  0

 

The code is as follows and I think the problem is in the red commas after
'ND':

 

INSERT INTO State ( State_ID , Country_ID , State_Name , State_Abbrev ,
State_Tax_Rate , State_Disabled ) VALUES ( 1 , 1 , 'Minnesota' , 'MN' , 6.5
, 0 ) , ( 2 , 1 , 'North Dakota' , 'ND' , , 0 ) , ( 3 , 1

 

This is a null in the array so I thought if I put a "DEFAULT 0" in the
CREATE SQL, it would take care of it.

 

CREATE TABLE IF NOT EXISTS State ( 

  State_ID INTEGER NOT NULL AUTO_INCREMENT COMMENT '' , 

  Country_ID INTEGER NOT NULL COMMENT '' , 

  State_Name TEXT(80) NOT NULL COMMENT '' , 

  State_Abbrev TEXT(2) NOT NULL COMMENT '' , 

  State_Tax_Rate REAL DEFAULT 0 COMMENT 'State Sales Tax Rate' , 

  State_Disabled TEXT(1) COMMENT 'Disabled - 1=Yes 0=No' , 

  PRIMARY KEY (State_ID) , 

  UNIQUE StateAbbreviation (State_Abbrev (2)) , 

  UNIQUE StateName (State_Name (30)) , 

  FOREIGN KEY (Country_ID) REFERENCES Country(Country_ID) 

) 

  COMMENT 'State/Provinces'

 

It worked ok in R:Base, does MySQL handle this differently?

 

Thanks

 

Steve Fogelson

Internet Commerce Solutions


________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to