最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php 调用mssql存储过程实例应用
时间:2022-06-24 19:14:11 编辑:袖梨 来源:一聚教程网
//连接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如下
代码如下 | 复制代码 |
/* 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来处理,否则会出问题
本站原创文章转载注明来源于www.111com.net 中国WEB第一站
相关文章
- 人们熟悉的寄居蟹属于以下哪种分类 神奇海洋11月21日答案 11-21
- 第五人格11.22共研服有什么更新 11月22日共研服更新内容介绍 11-21
- 原神恰斯卡怎么培养 11-21
- 无期迷途四星装束是谁 11-21
- 王者荣耀帝丹高中校服怎么获得 11-21
- 光遇姆明季后续版本怎么玩 11-21