Ms Sql stored procedures with parameters
| From: | meska | Date: | Wed, 04 Jan 2006 09:37:29 +0000 |
| Subject: | Ms Sql stored procedures with parameters | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-40965@lists.php.net to get a copy of this message | ||
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?