Ms Sql stored procedures with parameters
am 04.01.2006 10:37:29 von meska
Hi,
I've done it in various ways, still, no luck..
Lets say i have a stored procedure getSomeCoolData declared as :
[getSomeCoolData]
@prodCode char(255),
@prodName nvarchar(255),
@prodID int = NULL
This stored procedure returns products based on parameters i pass. So let's
say i do like this in Enterprise manager:
EXEC getSomeCoolData @ prodName = NULL, @prodCode = '061451221'
And i get one product - good ! (by unique code)
Now, let's say i'll do the same in php:
$result = mssql_query("EXEC getSomeCoolData @ prodName = NULL, @prodCode =
'061451221'");
BAM ! I get all the products, as all parameters where supplied as NULL or ''
( stored procedure checks for parameters, and if they are '' , it asigns
null.
Have tried various ways, still the same. Have tried to use
http://www.sitepoint.com/article/php-microsoft-sql-server/2 - the same
Any ideas?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Ms Sql stored procedures with parameters
am 04.01.2006 15:17:12 von Robert Twitty
Hane you tried
$result = mssql_query("EXEC getSomeCoolData '061451221', NULL, NULL" );
Also, did you try mssql_init()?
-- bob
On Wed, 4 Jan 2006, meska wrote:
> Hi,
>
> I've done it in various ways, still, no luck..
>
> Lets say i have a stored procedure getSomeCoolData declared as :
>
> [getSomeCoolData]
> @prodCode char(255),
> @prodName nvarchar(255),
> @prodID int = NULL
>
>
> This stored procedure returns products based on parameters i pass. So let's
> say i do like this in Enterprise manager:
>
> EXEC getSomeCoolData @ prodName = NULL, @prodCode = '061451221'
>
> And i get one product - good ! (by unique code)
> Now, let's say i'll do the same in php:
>
> $result = mssql_query("EXEC getSomeCoolData @ prodName = NULL, @prodCode =
> '061451221'");
>
> BAM ! I get all the products, as all parameters where supplied as NULL or ''
> ( stored procedure checks for parameters, and if they are '' , it asigns
> null.
>
> Have tried various ways, still the same. Have tried to use
> http://www.sitepoint.com/article/php-microsoft-sql-server/2 - the same
>
> Any ideas?
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php