"stored procedure execution failed"
am 25.08.2008 14:06:21 von bertrand.lods--=_alternative 00426E0BC12574B0_=
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi everyone
I have some problem with stored procedure.
I work on trustix web server ( LAMP ), and my database run on MsSql Server =
2005.
I try to lauch my stored procedure from PHP like this :=20
[code]
$tableau=3Darray();
// connexion =E0 la base mssql =3D> $connexion=5Fbase =3D identifiant de li=
en MS=20
SQL
$connexion=5Fbase=3Dmssql=5Fconnect($sql=5Fserveur,$sql=5Fus er,$sql=5Fpassw=
d)=20
or die ("impossible de se connecter =E0 SQL Server sur $sql=5Fserveur");
mssql=5Fselect=5Fdb ($sql=5Ftable,$connexion=5Fbase)
or die("erreur de connection =E0 la base de donn=E9es $bdd");
// Initilisation de la proc=E9dure stock=E9e.
// mssql=5Finit("nom de la procedure stock=E9e sans le dbo", lien issu du=20
mssql=5Fconnect)
$req=5Fpreview=3Dmssql=5Finit("Select=5FTACHE",$connexion=5F base)or die ("e=
rreur=20
initialisation de la proc=E9dure") ;
// Initilisation des variables.
mssql=5Fbind($req=5Fpreview,"@id=5FTYPE=5FBON",$type=5Fbon,S QLINT1) or die =
("erreur=20
initialisation de variable") ;
$result=3Dmssql=5Fexecute($req=5Fpreview);
[/code]
I would like to know if my code is correct.
Then with this code I've got this error message :
"Warning:mssql=5Fexecute()[function.mssql-execute]:stored procedure=20
execution failed.
This is my stored procedure in Mssql Server 2005 :
[code]
set ANSI=5FNULLS ON
set QUOTED=5FIDENTIFIER ON
GO
-- ==================== =====
==================== =3D
-- Author:<>
-- Create date: <21/08/2008>
-- Description:<>
-- ==================== =====
==================== =3D
ALTER PROCEDURE [dbo].[Select=5FTACHE]=20
-- Add the parameters for the stored procedure here
@id=5FTYPE=5FBON int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
=20
SELECT lettre, intitule, tache=5Ftype
FROM DEV=5FTACHE
WHERE id=5FTACHE IN=20
(SELECT id=5FTACHE
FROM DEV=5FREL=5FBON=5FTACHE
WHERE DEV=5FREL=5FBON=5FTACHE.id=5FTYPE=5FBON=3D@id=5FTYPE=
=5FBON)
END
[/code]
I tested with standard query like :
[code]
$tableau=3Darray();
=20
// connexion =E0 la base mssql =3D> $connexion=5Fbase =3D identifiant de li=
en MS=20
SQL
$connexion=5Fbase=3Dmssql=5Fconnect($sql=5Fserveur,$sql=5Fus er,$sql=5Fpassw=
d)=20
or die ("impossible de se connecter =E0 SQL Server sur $sql=5Fserveur");
=20
mssql=5Fselect=5Fdb ($sql=5Ftable,$connexion=5Fbase)
or die("erreur de connection =E0 la base de donn=E9es $bdd");
=20
$result =3D mssql=5Fquery("
SELECT lettre, intitule, tache=5Ftype
FROM DEV=5FTACHE
WHERE id=5FTACHE IN=20
(SELECT id=5FTACHE
FROM DEV=5FREL=5FBON=5FTACHE
WHERE=20
DEV=5FREL=5FBON=5FTACHE.id=5FTYPE=5FBON=3D$type=5Fbon) ",
$connexion=5Fbase)
or die (mssql=5Ferror());
=20
while($val=3Dmssql=5Ffetch=5Farray($result,MSSQL=5FASSOC))
{
$tableau[]=3D$val;
}
[/code]
And I have no problem with standard query
I expect some help. You can ask me more precision.
Thank you=20
If you are not the intended addressee, please inform us immediately that yo=
u have received this e-mail in error, and delete it. We thank you for your =
cooperation. =
--=_alternative 00426E0BC12574B0_=--