<?php
$hostname = "tszzp";
$dbuser = "sa";
$dbpasswd = "";
$id = mssql_connect($hostname,$dbuser,$dbpasswd) or die("無法連線資料庫伺服器!");
//printf("%d
/n", $id);
$db = mssql_select_db("stock",$id) or die("無法連線stock資料庫!");
$stockcode='600600';
$id = 0;
$msg = 0;
//printf("%d
/n", $db);
//$query = "exec sp_test @code='600028',@id=0,@msg='000000'";
$query = "declare @result int, @id int, @msg varchar(20)/n";
$query.="exec @result=sp_test/n";
$query.="/"$stockcode/",/n";
$query.="@id output,/n";
$query.="@msg output;/n";
$query.="select @result result, @id id, @msg msg";
/*$query = "declare @result int, @id int, @msg varchar(20)/n";
$query.="exec @result=sp_test/n";
$query.="/"$stockcode/",/n";
$query.="@id output,/n";
$query.="@msg output;/n";
$query.="select @result result, @id id, @msg msg";
*///$query = "update test set stockname='2test' where stockcode='600028'";
//$query = "insert into test(stockcode,stockname,id) values ('600028','test',13)";
//$query = "select * from test where stockcode='600028'";
//$query = "select 0 where 1=0 ";
$rresult = mssql_query($query) or die("無法執行sql:$query");
$arr = mssql_fetch_array($rresult);
print $result;
print "
/n";
printf("%d, %d, %s
/n", $arr[result], $arr[id], $arr[msg]);
printf("%d, %s
/n", $id, $msg);
//$stock = mssql_fetch_array($result);
//$name = $stock[id];
//print $name;
//print "abc";
php呼叫mssql儲存過程
一.建立資料庫並建立表 表users 字段 id和name 二.建立儲存過程 create procedure proctest id int,name varchar 30 output asselect name name from users where id id select from u...
MSSQL儲存過程
sqlserver 帶有返回值,儲存過程同時新增兩張表,並將第一張表的主鍵插入第二張表當中 2010 07 04 22 00 55 分類 sql 字型大小 訂閱 sql server 中,可以使用 scope identity identity ident current 來取得最後插入記錄的值值,...
php呼叫mysql 儲存過程
php可以通過查詢語句 call procedurename 來呼叫mysql的儲存過程。但不能使用mysql 相關函式得用mysqli 相關函式。建立儲存過程 use test create procedure sta select from ta connstr mysqli connect l...