PHP calls mssql stored procedure example application_PHP tutorial

WBOY
Release: 2016-07-13 17:04:23
Original
816 people have browsed it

Use the mssql_init statement to initialize the stored procedure, then call the mssql_bind statement to specify the stored procedure parameters, and finally call mssql_execute to execute the stored procedure.

php tutorial calling mssql stored procedure instance application

Use the mssql_init statement to initialize the stored procedure, then call the mssql_bind statement to specify the stored procedure parameters, and finally call mssql_execute to execute the stored procedure.
*/

//Connect to mssql database tutorial server

$link = mssql_connect("127.0.0.1", "sa", "sa") or die("Can't connect sql server");
mssql_select_db("frrc", $link) or die("Select database failure");

//Initialize and load the stored procedure Bigdatabase

$stmt = mssql_init("Bigdatabase", $link) or die("initialize stored procedure failure");
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");

do{
While( $ms_rs = mssql_fetch_object($ms_result) )
{
//Perform data processing
}
}

// msssql stored procedure Bigdatabase is as follows

/*
CREATE PROCEDURE Bigdatabase
@pagesize int,
@start int
AS
declare @bsql nvarchar(4000)
set @bsql = 'select top ' + str(@pagesize) + ' username,jobid,password,useremail,zcdata,ip,name,xingbie,minzu,xueli,hunyin,age,xuexiao,zyclass,zhuanye,x_suozaidi,x_suozaidi1, huji,huji1,shengao,byyear,birthyear,birthmonth,birthday,dianhua,qq,gerenzhuye,selectedjob1,selectedjob2,selectedjob3,s_PWL1,s_PWL2,s_PWL3,daiyuyaoqiu,Negotiable,provideHouseNeeded,availOpts,availNotice,llcs,CONVERT(varchar(100) ,dlsj, 25) as dlsj,xgsj,dlcs,jsjshuiping,language_one,l_OneAbility,language_two,l_twoAbility,mandarinLevel,skillkey,jingyan,photopb,photo,phototre,mbsys,codetype,code,shouji,posts,address,jobtype,convert( varchar(8000),pingjia) as pingjia ,convert(varchar(8000),jinengzhuanchang) as jinengzhuanchang ,convert(varchar(8000),fazhanfangxiang) as fazhanfangxiang,convert(varchar(8000),other) as other 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
GO

Note: Text must be converted into varchar for processing, otherwise problems will occur

Original articles on this site are reprinted from www.bKjia.c0m China’s first WEB station

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630876.htmlTechArticleUse the mssql_init statement to initialize the stored procedure, then call the mssql_bind statement to specify the stored procedure parameters, and finally call mssql_execute to execute the stored procedure . PHP tutorial calling mssql stored procedure...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template