i trying to calling mssql stored procedure from PHP and failed when trying to passing money parameter. This is my code:
$proc = mssql_init("sp_something");
mssql_bind($proc, "@param1", $param1, SQLINT4, false, false);
mssql_bind($proc, "@param2", $param2, SQLINT4, false, false);
mssql_bind($proc, "@param3", $param3, SQLVARCHAR, false, false, 5);
mssql_bind($proc, "@param4", $param4, SQLINT4, false, false);
mssql_bind($proc, "@param5", $param5, SQLMONEY, false, false);
mssql_bind($proc, "@param6", $param6, SQLMONEY, false, false);
mssql_bind($proc, "@param7", $param7, SQLVARCHAR, true);
mssql_execute($proc);
echo mssql_get_last_message();
and its failed and last message is :
Procedure or function 'sp_something' expects parameter '@param5',
which was not supplied.
this is my stored procedure :
ALTER PROCEDURE [dbo].[sp_something]
@param1 smallint,
@param2 smallint,
@param3 varchar(8),
@param4 int,
@param5 money,
@param6 money,
@param7 bit OUTPUT AS
--some stored proc
i try exec it from sql server management studio and its SUCCESS:
exec sp_something 2014,5,'123456',1,12345.23,22222.33,0
is there any tricky way when you want to pass money datatype? cause i have another stored procedure without money parameter and it runs smooth..
So finally i just use with SQLVARCHAR
for money parameter and its works well
mssql_bind($proc, "@param5", $param5, SQLVARCHAR, false, false);
mssql_bind($proc, "@param6", $param6, SQLVARCHAR, false, false);