萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mssql數據庫 >> php 調用mssql 2000存儲過程代碼

php 調用mssql 2000存儲過程代碼

   php 調用mssql 2000存儲過程代碼這是我昨天做出來了哦,下面我們先看看利用php調用mssql的存儲過程的代碼吧

  $start = isset($_GET['start'])?$_GET['start']:0;

  $end = isset($_GET['end'])?$_GET['end']:0;

  $pagesize = isset($_GET['pagesize'])?$_GET['pagesize']:0;

  $stmt = mssql_init("Bigdatabase", $link) or die("");

  mssql_bind($stmt, "@pagesize", $pagesize, SQLINT4);

  mssql_bind($stmt, "@start", $start, SQLINT4);

  @$ms_result = mssql_execute($stmt, false);

  mssql_query("DUMP TRANSACTION tempdb WITH NO_LOG");

  現在來看mssql數據表存儲過程函數哦Bigdatabase

  CREATE PROCEDURE Bigdatabase

  @pagesize int,

  @start int

  AS

  declare @bsql nvarchar(4000)

  set @bsql = 'select top ' + str(@pagesize) + ' username,from person where id not in(select top ' + str(@start) + ' id from person order by id asc) order by id asc'

  execute sp_executesql @bsql

copyright © 萬盛學電腦網 all rights reserved