Win32::ODBC insert statement fails

  • Thread starter Domenico Discepola
  • Start date
D

Domenico Discepola

Hello all. Some of my insert statements fail with the following error: SQL
Statement failed: [105] [1] [0] "[Microsoft][ODBC SQL Server Driver][SQL
Server]Unclosed quotation mark before the character string '(555)
555-5200'."

I'm using Microsoft SQL Server 2000 as my database server. What's funny is
that if I copy/paste the exact sql statement into my query tool (Query
Analyzer), the statement executes with no problems.

My sql statement (printed 1 field per line for clarity):

insert into dw.dbo.dim_customer values
( 24988 ,
'15937' ,
'Company X' ,
'Active',
'8C8BAB33D7CF59E1852562A50022F25E',
'City',
'Prospect',
'(555) 555-5200 (800) 555-7887',
'01/06/2004 10:24:19',
'01/06/2004',
'10:24:19' ,
'Company',
'Galvanizing',
null,
'',
'Person1',
'[Location]',
'Person 2',
'Person 3',
'Person 4',
null,
'08/05/2003',
'11:37:44',
'AM',
1,
3
)

Any thoughts as to why Win32::ODBC returns an error when I execute this
using the Sql method:
if ($g_dbhandle->Sql($SqlStatement)){
$stmt = $g_dbhandle->Error();
print "SQL Statement failed: ${stmt}\n";
$g_dbhandle->Close();
print "${SqlStatement}\n";
exit;
}

TIA
 
D

Domenico Discepola

Domenico Discepola said:
Hello all. Some of my insert statements fail with the following error: SQL
Statement failed: [105] [1] [0] "[Microsoft][ODBC SQL Server Driver][SQL
Server]Unclosed quotation mark before the character string '(555)
555-5200'."


Any thoughts as to why Win32::ODBC returns an error when I execute this
using the Sql method:
if ($g_dbhandle->Sql($SqlStatement)){
$stmt = $g_dbhandle->Error();
print "SQL Statement failed: ${stmt}\n";
$g_dbhandle->Close();
print "${SqlStatement}\n";
exit;
}

I found the solution to my problem. Using an octal dump program, I
"discovered" \x00 characters embedded in my incoming data. I recoded my
program to remove them and my insert statement works fine now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top