Re: SQL Native Client 10 ODBC + " delimiter + ;1 results in 'Could not find stored procedure'
- From: "Sylvain Lafontaine" <sylvainlafontaine2009@xxxxxxxx>
- Date: Tue, 7 Apr 2009 17:32:59 -0400
Try replacing the double quote with []: call [dbo].[stproc;1]
There is an option on SQL-Server to activate or deactive the use of " as the
object delimiter and it's called the QUOTED_IDENTIFIER setting. When
QUOTED_IDENTIFIER is ON (and it's better to have it always ON) then " will
be used as the object delimiter; when it's OFF then " will be seen as a
string delimiter instead.
Even it should be ON, by default, on many databases, it's OFF but many
providers will automatically set it ON when opening a connection. Honestly,
knowing and understanding it's actual configuration can be a real labyrinth.
Personally, I try to set it to ON wherever I can and I never use " as the
object delimiter or as a string delimiter, only the [ ] for objects and the
single quote ' for the strings.
--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)
"Michael Burstin" <mburstin@xxxxxxxxxxxxxxxxx> wrote in message
news:Of9tc16tJHA.4324@xxxxxxxxxxxxxxxxxxxxxxx
I think that this has to be a bug in the SQL Native Client 10 version
because this used to work against SQL Server 2005 using its SQL Native
Client as well as if I use v9 of the SQL Native client against SQL Server
2008.
I have a generic tool which uses SQLProcedures catalog calls to determine
the names of stored procedures to call. For example, lets say that the
procedure is named:
dbo.stproc;1
The tool then uses the " " delimiters and calls the stored procedure as:
{call "dbo"."stproc;1"}
The call to SQLPrepare is successful (looking at the Driver Manager Log)
and everything appears to be fine. Now, when I go to SQLExecute the
stored procedure, I get an error:
DIAG [42000] [Microsoft][SQL Server Native Client 10.0][SQL Server]Could
not find stored procedure 'dbo.stproc;1'. (2812)
If I use a tool like ODBCTest from MDAC, I have determined that the
following syntax works:
{call "dbo"."stproc";1}
{call dbo.stproc;1}
{call "dbo".stproc;1}
{call "dbo"."stproc"}
The problem is, if I want to use what SQLProcedures returns ("stproc;1")
and use delimiters, I get an error. The above cases just show that some
flavors of syntax works, but the one provided by the catalog calls fail!
I believe this is a bug. Can someone verify and tell me what to do about
it?
.
- Follow-Ups:
- References:
- Prev by Date: SQL Native Client 10 ODBC + " delimiter + ;1 results in 'Could not find stored procedure'
- Next by Date: Re: SQL Native Client 10 ODBC + " delimiter + ;1 results in 'Could not find stored procedure'
- Previous by thread: SQL Native Client 10 ODBC + " delimiter + ;1 results in 'Could not find stored procedure'
- Next by thread: Re: SQL Native Client 10 ODBC + " delimiter + ;1 results in 'Could not find stored procedure'
- Index(es):
Relevant Pages
|