Mssql_execute failed, stored procedure execution failed "

I am currently successfully connecting to an SQL database located in Windows 2008 using the following query:

$result = mssql_query("EXEC dbo.stored_procedure_name @param_level = 2"); 

I base my queries on existing code written in VB / ADO that looks like this:

 If level = "" Then level = 1 cmdTT.ActiveConnection = connStrTest1 set objParam=cmdTT.CreateParameter("@param_level", adInteger, adParamInput, 4, level) cmdTT.Parameters.Append objParam set rsTT = cmdTT.Execute 

So, I tried to do the following:

 $f = 2; $stmt = mssql_init('dbo.stored_procedure_name', $mssql_link); mssql_bind($stmt, "@param_level", $f, SQLINT4, false); mssql_execute($stmt); 

But no matter what variation always seems printed, print a warning on the screen : " Warning: mssql_execute () [function.mssql-execute]: stored procedure execution failed ... ".

What is the best way for me to debug here? Can anyone see a clear fix for my problem?

I am now connecting remotely to the database from the LAMP stack.

Many thanks Ian

+4
source share
3 answers

Is it from a linux server using FreeTDS? If so, I wonder if this is related to the TDS version. Try tds version = 8.0 in you / etc / freetds.conf

+3
source

Run the contents of the stored procedure from w / in the sql editor with hardcoded parameters. This way you will get more detailed error messages.

+1
source

I know this is an old post, but I'm sure it will help someone.

You should add mssql_free_statement($stmt) after execution.

+1
source

All Articles