January 8, 2013 at 6:34 am
What error?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 8, 2013 at 6:42 am
Sorry for missing that out. The error is:
1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Must declare the scalar variable "@CardName". 2). [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement 'Service Contracts' (OCTR) (s) could not be prepared.
January 8, 2013 at 7:12 am
And exactly how are you calling that piece of code?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 8, 2013 at 7:17 am
I am running it directly in the application's (SAP in this case) query generator.
Tried to run it SQL server management studio but it runs without error but with no result, so thought its not the place to run it.
January 8, 2013 at 7:24 am
How *exactly* are you calling that? Are you calling the entire piece as you've written there? Are you calling just the query? If so, have you defined the parameters?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 8, 2013 at 7:29 am
I am calling the entire piece as written, with parameter @CardName declared exactly how I have above.
Regards.
January 8, 2013 at 7:30 am
As you have it above, @CardName is not a parameter, it's a local variable.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 8, 2013 at 7:48 am
Thanks for your reply.
I have brain freeze right now. Without disputing what you just said, I have more queries successfully running with the same syntax; what's uniquly stupid I am doing?
January 8, 2013 at 8:01 am
Fair warning. I only know the barest bit about SAP because I work with someone in another state who uses it. That being said, does this article help?
January 8, 2013 at 9:10 am
Hi Brandie,
You pointed me to the right direction and sometimes that's the best thing to do.
Added this in the start of my query and everything was good:
/* SELECT FROM [dbo].[OINV] T2 */
DECLARE @Cust AS nvarchar(100)
/* WHERE */
SET @Cust = /* T2.CardName */ '[%0]'
[Although I must admit I spent more time reading your website and profile then working on the solution.]
Thank you.
Best Regards
Kanu
January 8, 2013 at 9:22 am
I thought you said you were calling the exact piece of code as you gave above, with the declare and set in it?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 8, 2013 at 9:31 am
Glad I could help. @=)
January 8, 2013 at 9:32 am
GilaMonster (1/8/2013)
I thought you said you were calling the exact piece of code as you gave above, with the declare and set in it?
Gail, believe it or not, that additional comment is required in the SAP interface. The code failed because it wasn't in his original code.
January 8, 2013 at 9:37 am
Brandie Tarvin (1/8/2013)
GilaMonster (1/8/2013)
I thought you said you were calling the exact piece of code as you gave above, with the declare and set in it?Gail, believe it or not, that additional comment is required in the SAP interface. The code failed because it wasn't in his original code.
And I am looking for the reason why this extra bit is required, or rather how does a comment make so much difference to a program.
January 8, 2013 at 9:48 am
Brandie Tarvin (1/8/2013)
GilaMonster (1/8/2013)
I thought you said you were calling the exact piece of code as you gave above, with the declare and set in it?Gail, believe it or not, that additional comment is required in the SAP interface.
A comment is required???? What kind of messed up program need specific comments to work?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 15 posts - 1 through 15 (of 17 total)
You must be logged in to reply to this topic. Login to reply