Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/07/2011, 14:00
Diosmx
 
Fecha de Ingreso: julio-2011
Mensajes: 1
Antigüedad: 13 años, 4 meses
Puntos: 0
Información Warning: sqlsrv_query() expects parameter 1 to be resource

Estoy tratando de ejecutar uns SP en SQL Server 2008 r2 desde PHP Tengo el siguiente error:

Warning: sqlsrv_query() expects parameter 1 to be resource, boolean given in C:\Archivos de programa\EasyPHP\www\lFinanzas\PHP\spEnviarDatos.p hp on line 45
Error in executing query.
Error in $stmt=
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -14 [code] => -14 [2] => An invalid parameter was passed to sqlsrv_query. [message] => An invalid parameter was passed to sqlsrv_query. ) )

mi SP en SQL Server es:
USE [database requerida]
GO
/****** Object: StoredProcedure [dbo].[cst_pasaTE] Script Date: 07/04/2011 12:04:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Batch submitted through debugger: SQLQuery4.sql|0|0|
-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================

-- =============================================
-- Author:
-- Create date:
-- Description:
-- =============================================
ALTER PROCEDURE [dbo].[cst_pasaTE]
-- Add the parameters for the stored procedure here
@dia varchar(8)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
insert into openquery(MYSQL, 'select AU_DES_TRA
,AU_FECHA
,AU_TIPO
,CB_CLASIFI
,CB_CODIGO
,AU_TIPODIA
,AU_HOR_MAN
,CB_TURNO
,CB_PUESTO
,HO_CODIGO
,CB_NIVEL1
,CB_NIVEL2
,CB_NIVEL3
,CB_NIVEL4
,CB_NIVEL5
,CB_NIVEL6
,CB_NIVEL7
,CB_NIVEL8
,CB_NIVEL9
,AU_AUT_EXT
,AU_AUT_TRA
,AU_STATUS
,AU_NUM_EXT
,AU_TRIPLES
,US_CODIGO
,AU_POSICIO
,AU_HORASCK
,AU_OUT2EAT
,PE_YEAR
,PE_TIPO
,PE_NUMERO
,AU_HORASNT
,CB_SALARIO
,AU_STA_FES
,AU_PRE_EXT
,CB_NOMINA
,LLAVE
,AU_DOBLES
,AU_EXTRAS
,AU_HORAS
,AU_PER_CG
,AU_PER_SG
,AU_TARDES
from pruebaste')
SELECT [AU_DES_TRA]
,[AU_FECHA]
,[AU_TIPO]
,[CB_CLASIFI]
,[CB_CODIGO]
,[AU_TIPODIA]
,[AU_HOR_MAN]
,[CB_TURNO]
,[CB_PUESTO]
,[HO_CODIGO]
,[CB_NIVEL1]
,[CB_NIVEL2]
,[CB_NIVEL3]
,[CB_NIVEL4]
,[CB_NIVEL5]
,[CB_NIVEL6]
,[CB_NIVEL7]
,[CB_NIVEL8]
,[CB_NIVEL9]
,[AU_AUT_EXT]
,[AU_AUT_TRA]
,[AU_STATUS]
,[AU_NUM_EXT]
,[AU_TRIPLES]
,[US_CODIGO]
,[AU_POSICIO]
,[AU_HORASCK]
,[AU_OUT2EAT]
,[PE_YEAR]
,[PE_TIPO]
,[PE_NUMERO]
,[AU_HORASNT]
,[CB_SALARIO]
,[AU_STA_FES]
,[AU_PRE_EXT]
,[CB_NOMINA]
,[LLAVE]
,[AU_DOBLES]
,[AU_EXTRAS]
,[AU_HORAS]
,[AU_PER_CG]
,[AU_PER_SG]
,[AU_TARDES]
FROM [tabla requerida] AU
where AU.AU_FECHA = @dia

END

y mi codigo PHP es el siguiente:

$params = array(
array($diai, SQLSRV_PARAM_IN)
);

$tsql = "{call cst_pasaTE(?)}";

$stmt = sqlsrv_query($conn, $tsql, $params); // aqui es donde marca el error