all groups > sql server odbc > february 2004 >
You're in the

sql server odbc

group:

SQL with Sybase



SQL with Sybase Anatoli Dontsov
2/20/2004 7:09:46 PM
sql server odbc: Hi, All

SQL2000/sp3 and Sybase 11.5

There is a SP on Sybase

CREATE PROC sp_test @t VARCHAR(32) = 'default string'
AS
SELECT @t

I want execute that from SQL

SELECT * FROM
OPENROWSET('MSDASQL', 'MySybase';'uid';'pwd', 'exec sp_test')

works file. But with the parameter it fails

SELECT * FROM
OPENROWSET('MSDASQL', 'MySybase';'uid';'pwd', 'exec sp_test "TEST"')

Could not process object 'exec sp_test "TEST"'. The OLE DB
provider 'MSDASQL' indicates that the object has no columns.

OLE DB error trace [Non-interface error: OLE DB provider unable to
process object, since the object has no columnsProviderName='MSDASQL',
Query=exec sp_test "TEST"'].


Any suggestions?

Best regards, Anatol



Re: SQL with Sybase Erland Sommarskog
2/22/2004 10:50:55 PM
[posted and mailed, please reply in news]

Anatoli Dontsov (Anatoli@dontsov.com) writes:
[quoted text, click to view]

On SQL Server the setting QUOTED_IDENTIFIER is on by default when you
connect from anything by DB-Library. Sybaes has a similar setting, but
I don't know which defaults that apply.

In any case, with this setting, names in double quotes are identifiers not
string literal. Try this instead:

SELECT * FROM
OPENROWSET('MSDASQL', 'MySybase';'uid';'pwd', 'exec sp_test ''TEST''')


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
Re: SQL with Sybase Anatoli Dontsov
2/23/2004 7:13:50 PM
[quoted text, click to view]
No, it isn't a quotes issue. The same effect if the parameter is integer.

SELECT * FROM
OPENROWSET('MSDASQL', 'MySybase';'uid';'pwd', 'exec sp_test 1')


Best regards, Anatoli


[quoted text, click to view]


Re: SQL with Sybase Erland Sommarskog
2/24/2004 11:17:58 PM
Anatoli Dontsov (Anatoli@dontsov.com) writes:
[quoted text, click to view]

I'm afraid I'm stumped. One possible reason for the error from OLE DB
is that there is an execution error, but there are other possible reasons.

Your procedure name makes me a little nervous, sp_ is reserved for
system procedures; I don't know how Sybase handles these days.

There is no specification of database in the sample, but maybe MySybase is
a DSN which sets up? Or is is the databaes in the default database of
uid?

--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
AddThis Social Bookmark Button