这是我的存储过程,建立了一个链接服器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 10Warning: mssql_query() [function.mssql-query]: Query failed in E:\wwwroot\baofei\pinguan\test.php on line 10