?
Solved

syatax error in crystal reports while passing paramete to stored procedure like '(7,10)' gives error sysntax error near 'AND'

Posted on 2007-10-18
6
Medium Priority
?
1,069 Views
Last Modified: 2013-11-14
Not supported.
Details: ADO Error Code: 0x80040e14
Source: Microsoft OLE DB Provider for SQL Server
Description: Incorrect syntax near the keyword 'AND'.
SQL State: 42000
Native Error: 156

I didnt get the above error if i manually pass the paramete to procedure like '(7,10)'
but report gives error when i pass the parameter like @ClientType

please suggest what would be the problem?
0
Comment
Question by:s_chilkury
  • 2
4 Comments
 
LVL 5

Expert Comment

by:abith
ID: 20099846
May i see the query you are using inside SP?
0
 
LVL 42

Accepted Solution

by:
frodoman earned 1000 total points
ID: 20102964
I suspect that @ClientType returns a result of (7,10) not of '(7,10)' which would account for the error.

Change your formula to explicitly return the single quotes around the value and you should be fine.

frodoman
0
 
LVL 2

Expert Comment

by:watsonj
ID: 20130337
I'd agree with frodoman, but I'd probably just add the single quotes into the SQL Command around the parameter.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 20130405
>>> I'd probably just add the single quotes into the SQL Command around the parameter

But you have to be careful with this because your db driver may interpret that as text and not as a bind variable within quotes - depends on the driver of course but for universal consistency I wouldn't recommend this approach.

frodoman
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question