Search code examples
sqlsql-servert-sqllinked-serversybase-asa

Execute sybase stored procedure as linked server procedure sql server 2008


EDIT


The final goal is to call a stored procedure hosted in sybase with input and output parameters from SQL Server 2008 via Linked Server


I think title is pretty clear.

My goal is to execute a stored procedure hosted in Sybase SQL Anywhere 8 in SQL Server 2008 through the linked server I already created.

Any SQL query made through the linked server is working. In addition I was able to execute a function but I don't now how to get the return value like that

EXEC ('CALL "dbname"."procedurename"(''param1'', ''param2'', ''param3'')') AT LinkedServerAlias;

Thanks 4 all your help!

Mauro


Solution

  • I was finally able to do it by calling

    SELECT * FROM OPENQUERY([LinkedServer], 'SELECT "dbname"."spname"(@p1,@p2, @p3)')
    

    I'll add comments and example as soon as I experiment it.