I have an application that generates a prepared statement for processing data. This is the prepared statement that is being generated for the Contact object and fails:
declare @p1 int
set @p1=1
exec sp_prepare @p1 output,N'@P1 nchar(108)',N'SELECT C.AccountID, C.ID
FROM SALESFORCE...Contact C
WHERE (AccountID = @P1 )',1
select @p1
Using SQL Profiler, I am getting these Error Messages:
OLE DB provider "DBAmp.DBAmp" for linked server "SALESFORCE" returned message "Error 13005 : expecting ''''', found 'EOF'".
Error: 7320, Severity: 16, State: 2
Cannot execute the query "SELECT "Tbl1001"."AccountId" "Col1003","Tbl1001"."Id" "Col1004" FROM "Contact" "Tbl1001" WHERE "Tbl1001"."AccountId"=?" against OLE DB provider "DBAmp.DBAmp" for linked server "SALESFORCE".
The similar Account Prepared Statement is working:
declare @p1 int
set @p1=1
exec sp_prepare @p1 output,N'@P1 nvarchar(39)',N'SELECT Member_ID__c, A.ID AS AccountID
FROM SALESFORCE...Account A
WHERE (Member_ID__c = @P1 )',1
select @p1
Any ideas on what may be causing this?
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.


-
1. What version of DBAmp are you running ?
2. I have never seen sp_prepare used directly from SSMS. Therefore I am unfamiliar with its use. Can you tell me why you are using that vs. a more traditional TSQL cursor ?
3. When I try to run your code (either one) I get the following:
Msg 8179, Level 16, State 2, Procedure sp_prepare, Line 1
Could not find prepared statement with handle 1.
Is there something missing from your code block ? -
-
Just pulled out what was in SQL Profiler.
We are using IBM DataStage as our ETL tool, this is being generated for a SPARSE lookup, which means it will call the prepared statement passing the AccountID. An example from the Account one is:
exec sp_execute 1,N'0433433684000'
Answers to questions:
1. 2.13.5
2. DataStage is generating it, I used Profiler so I could actually capture the error messages
3. I had the same problem, but has been a long time since I worked with prepared statements that I created, so I just thought I would start by posting the question, espically since it was working on the Account object. -
-
OK, I found if a comment the 2nd line it runs.
I just ran the Contact version on my system and I do not get the error with v 2.13.6
I would suggest upgrading to that version using the instructions found at www.forceamp.com/upgrade.htm You will need to restart SQL as part of the upgrade.
Then retry in SSMS (with line 2 commented) and see if the issue resolves -
-
Installed new version, and still getting same error. Will do more Profiling tomorrow to see if something show up.
BTW, commenting that line worked in prior version as well... -
-
Was the SQL Server restarted to ensure that is is using the latest version ?
Also, what is the result of the following query:
Select @@version -
-
Yes rebooted, here is the SQL Info...
Microsoft SQL Server 2005 - 9.00.1406.00 (Intel X86)
Mar 3 2007 18:40:02
Copyright (c) 1988-2005 Microsoft Corporation
Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 3) -