LookitsPuck
June 3rd, 2004, 01:29 PM
Hey! How's it going all!
I'm currently using Perl to pull data out of a SQL Server database, parse that data (and convert the necessary values), and then store that information into another SQL Server database.
HOWEVER! The code works perfectly fine for all the variables except the description variable. Here's the error that I get:
---------- Capture Output ----------
"C:\Perl\bin\perl.exe" dataextractor.cgi
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string '*** TOWSVC01 run ServiceCenter Log mover job in place of regular ServiceCenter b'. (SQL-42000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 6: Incorrect syntax near '*** TOWSVC01 run ServiceCenter Log mover job in place of regular ServiceCenter b'. (SQL-42000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (SQL-42000)(DBD: st_execute/SQLExecute err=-1) at dataextractor.cgi line 271.
Couldn't execute statement: [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string '*** TOWSVC01 run ServiceCenter Log mover job in place of regular ServiceCenter b'. (SQL-42000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 6: Incorrect syntax near '*** TOWSVC01 run ServiceCenter Log mover job in place of regular ServiceCenter b'. (SQL-42000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (SQL-42000)(DBD: st_execute/SQLExecute err=-1) at dataextractor.cgi line 271.
Terminated with exit code 255
And here's my code for that particular section:
$WEsth = $WEdbh->prepare("INSERT INTO dbo.fauxevents (id, cal, gmt_start, gmt_end,
year, month, day, repeatid, multicalid, approved, options,
title, eventtype, category, description)
VALUES ('$id','$cal','$gmtStart','$gmtEnd','$year','$month',
'$day','$repeatID','$multiCalID','$approved','$options',
'$title','$eventType','$category','$description')")
or die "Couldn't prepare statement: " . $WEdbh->errstr;
# Execute the query
$WEsth->execute()
or die "Couldn't execute statement: " . $WEsth->errstr;
Any idea why I'm getting that error? I've went through the data in the database, and I don't see any single quotes from the description field. As a cautionary method, I made a small subroutine that would replace all single quotes with spaces, however, I'm still getting that bloody error. It also doesn't seem to like asterisks, any idea why?
Thanks,
-Stephen
I'm currently using Perl to pull data out of a SQL Server database, parse that data (and convert the necessary values), and then store that information into another SQL Server database.
HOWEVER! The code works perfectly fine for all the variables except the description variable. Here's the error that I get:
---------- Capture Output ----------
"C:\Perl\bin\perl.exe" dataextractor.cgi
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string '*** TOWSVC01 run ServiceCenter Log mover job in place of regular ServiceCenter b'. (SQL-42000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 6: Incorrect syntax near '*** TOWSVC01 run ServiceCenter Log mover job in place of regular ServiceCenter b'. (SQL-42000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (SQL-42000)(DBD: st_execute/SQLExecute err=-1) at dataextractor.cgi line 271.
Couldn't execute statement: [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string '*** TOWSVC01 run ServiceCenter Log mover job in place of regular ServiceCenter b'. (SQL-42000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 6: Incorrect syntax near '*** TOWSVC01 run ServiceCenter Log mover job in place of regular ServiceCenter b'. (SQL-42000)
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (SQL-42000)(DBD: st_execute/SQLExecute err=-1) at dataextractor.cgi line 271.
Terminated with exit code 255
And here's my code for that particular section:
$WEsth = $WEdbh->prepare("INSERT INTO dbo.fauxevents (id, cal, gmt_start, gmt_end,
year, month, day, repeatid, multicalid, approved, options,
title, eventtype, category, description)
VALUES ('$id','$cal','$gmtStart','$gmtEnd','$year','$month',
'$day','$repeatID','$multiCalID','$approved','$options',
'$title','$eventType','$category','$description')")
or die "Couldn't prepare statement: " . $WEdbh->errstr;
# Execute the query
$WEsth->execute()
or die "Couldn't execute statement: " . $WEsth->errstr;
Any idea why I'm getting that error? I've went through the data in the database, and I don't see any single quotes from the description field. As a cautionary method, I made a small subroutine that would replace all single quotes with spaces, however, I'm still getting that bloody error. It also doesn't seem to like asterisks, any idea why?
Thanks,
-Stephen