Jump to content

Recommended Posts

I am using php odbc functions to connect to a MSSQL db and run stored procedures. usually, the procedures i use return record sets which are easy enough to extract data from using odbc_fetch_row() odbc_result() etc..

 

Unfortunately i have been given a set of stored procedures that return variables intead of record sets. i have been going through the odbc functions in the php manual and cant for the life of me figure out how to access them. obviously fetch_row and _result dont work and neither does anything else. i always seem to get "No tuples available at this result index". i understand why this is so, but cant figue out the correct way to access the data...

 

any ideas or advice would be well and truly appreciated.

  • 2 months later...

Nothing should be stopping you from entering TSQL directly into your ODBC call. IIRC, you define your variables, call your stored procedure, then SELECT a row back out.

 

It looks something like:

 

DECLARE @foo1 INT
DECLARE @foo2 INT
CALL fooProc(@foo1, @foo2)
SELECT @foo1 AS foo1, @foo2 AS foo2

 

Sorry if there's a syntax error. It's been awhile, but the idea is the same.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.