PHP调用MSSQL存储过程(使用链接服务器)出现的问题

pkpmjc pkpmjc 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

这是我的存储过程,建立了一个链接服器Mysql,从oa_cost_per里面取数据插入到新建的临时表里面
CREATE PROCEDURE my
@begindate varchar(15),
@enddate varchar(15)
AS


set nocount on
set ansi_warnings on
create table #my_ep_temp_cost_per(itemno varchar(100) not null,costunit decimal(10,4));
insert into #my_ep_temp_cost_per select * from openquery(mysql,'select item_no,cost_unit from oa_cost_per')
select * from #my_ep_temp_cost_per
GO
我在查询分析器里面exec执行,没有出错,可以执行出来.
但是我在php里面调用
<?php
$conn=mssql_connect('192.168.1.38','xuejiazhi','19830421');
//选择数据库
mssql_select_db('newskylight',$conn);
$a='2009-01-01';
$b='2009-08-01';
$xyz="exec my '".$a."','".$b."'";
echo $xyz;
mssql_query($xyz,$conn);
?>
这样就出错了\\
错误提示:
Warning: mssql_query() [function.mssql-query]: message: Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query. (severity 16) in E:\wwwroot\baofei\pinguan\test.php on line 10

Warning: mssql_query() [function.mssql-query]: Query failed in E:\wwwroot\baofei\pinguan\test.php on line 10
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
pkpmjc
基础编程 21,889 成员 140,329 内容