PHP call MSSQL Stored Procedure instance Application _php Tutorial

Source: Internet
Author: User
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 calls 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 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))
{
For data processing
}
}

Msssql stored procedures are bigdatabase 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,byear,birthyear,birthmonth, Birthday,dianhua,qq,gerenzhuye,selectedjob1,selectedjob2,selectedjob3,s_pwl1,s_pwl2,s_pwl3,daiyuyaoqiu, Negotiable,providehouseneeded,availopts,availnotice,llcs,convert (varchar (+), DLSJ,) 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, and from the person where ID not in (select top ' + str (@start) + ' ID from the person order by I D ASC) Order by ID ASC '
Execute sp_executesql @bsql
GO

Note: text must be converted to varchar for processing, otherwise it will be problematic

This site original article reproduced annotated from www.bKjia.c0m China web first station

http://www.bkjia.com/PHPjc/630876.html www.bkjia.com true http://www.bkjia.com/PHPjc/630876.html techarticle 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 Call MSSQL stored procedure ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.