您好,欢迎访问一九零五行业门户网

php调用mssql存储过程实例应用

用mssql_init语句用于初始化存储过程,而后调用mssql_bind语句指定存储过程参数,最后调用mssql_execute执行存储过程.
连接mssql数据库教程服务器,代码如下:
$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); //初始化并加载存储过程 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) ) { //进行数据处理 } // msssql 存储过程 bigdatabase如下 //开源代码phprm.com /* 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,byear,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
注:必须把text转换成varchar来处理,否则会出问题.
教程链接:
随意转载~但请保留教程地址★
其它类似信息

推荐信息