存储过程
存储过程如下:
CREATE PROCEDURE test
@TableName char(20),
@ii char(20) 出力,
@bb char(20) 出力
AS
nocount on
/*
が存在する場合 (1 を選択) from demo_table where t_name=@TableName)
set @ii = 'yes'
else
begin
--RAISERROR('not have such table',16,1)
set @ii = 'no'
end
*/
select @ii = t_id from Demon_table where t_name = @TableName
if @ii is null
begin
set @ii = 'no'
set @bb = 'hello'
end
else
set @bb = 'HAHAHAHAHQAH'
select @ii as ii,@bb as bb
GO
include "conn.php";//连接数据库
/*
$query = " exec test 'demo_kh'";
$r = $db->query($query);
$result = $db->fetch_array($r);
echo $result['t_name'];
*/
$query = "declare @ii varchar(20) ),@bb varchar(20)n";
$query .= "テスト 'demo_kh' を実行,@ii 出力,@bb 出力n";
$r = $db->fetch_array($db->query( $query));
echo $r['ii'].$r['bb'];
?>