Thanks, Felix. Your suggestion worked. I'm now performing inserts on my MS_SQL database.
-fjohnson "Felix Geerinckx" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > on Fri, 17 May 2002 01:32:54 GMT, Fjohnson wrote: > > > The error I am getting with this version of the code is > > the following: > > DBD::Sybase::st execute failed: Server message number=170 > > severity=150 state=1 line=1 server='hostname' text=Line1: Incorrect > > syntax near ')' . at dbi.pl line 27, <STDIN> line 4. > > [ Code snipped and reformatted ] > > > $sth = $dbh->prepare(" > > insert into Books > > (Book_title, Author, Publisher, ISBN) > > values ('$Book_title', '$Author', '$Publisher','$ISBN') > > )") || die "Couldn't prepare statement: $DBI::errstr"; > > > > # execute query > > $sth->execute() || die "Can't execute the SQL statement: > > $DBI::errstr"; > > 1) You must use 'or' instead of '||' to avoid precedence problems. > ('||' has higher precedence than '=', but 'or' hasn't). > > 2) You have one too many ')' in your SQL statement, the last one within > the quotes. (This gives you the error message above). > > 3) Personally, I prefer placeholders: > > $sth = $dbh->prepare(" > insert into Books > (Book_title, Author, Publisher, ISBN) > values (?,?,?,?)"); > > and then call execute like so: > > $sth->execute($Book_title, $Author, $Publisher,$ISBN); > > -- > felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]