I'm writing a web application in php (which I have a decent knowledge of) and have been given queries to stored procedures in a SQL Server database. This is how I have used one of them:
function exampleFunction ($productId, $serialNbr, $companyName1, $companyName2, $companyName3) {
return ' exec dbo.getStuffFromDatabase @product_id = ' . $productId . ',
@serial_id = ' . $serialNbr . ',
@is_company_name1 = ' . $companyName1 . ',
@is_company_name2 = ' . $companyName2 . ',
@is_company_name3 = ' . $companyName3;
}
I have never worked with database programming before, and possibly I am making some simple misstake, but I can't get this to work. I was wondering if there is something I have missed with the $companyName-variables - as far as I can tell they are like booleans (bit:s) that can take the value 0 and 1. I have tried using true/false, integers and strings for these values, none worked. When I execute this query in SQL Server Manager it works fine.
Thanks!
Edit:
The script in Server Management Studio:
declare @product_id varchar(16)
declare @serial_id int
declare @is_company_name1 bit
declare @is_company_name2 bit
declare @is_company_name2 bit
set @product_id = 'all'
set @serial_id = 9999999
set @is_company_name1 = 0
set @is_company_name2 = 0
set @is_company_name2 = 1
exec [dbo].[getStuffFromDatabase]
@product_id = @product_id,
@serial_id = @serial_id,
@is_company_name1 = @is_company_name1,
@is_company_name2 = @is_company_name2,
@is_company_name3 = @is_company_name3