Buenas Tardes
tengo un problema tengo un SP bien Sencillo
ALTER PROCEDURE [dbo].[SP_OCUPACION]
@FECHAI Date,
@FECHAF Date,
@UNI Varchar (2),
@DIA INT
AS
BEGIN
DECLARE @rentados DECIMAL(8,0), @totales DECIMAL (8,0)
SELECT @rentados=SUM(FLOOR((case T1.[U_DURACION] when 'DIARIA' THEN T1.U_cantidad when 'SEMANAL' THEN T1.U_cantidad*7 when 'MENSUAL' THEN T1.U_cantidad*30 ELSE 0 END)))
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
where (T2.[QryGroup2] <>'Y' and T0.[invntsttus]<>'C')
and (T0.[Docdate]>=@FECHAI and T0.[Docdate] <= @FECHAF)
and (T1.[ItemCode] like @UNI+'-%%')
and (T1.[PriceAfVAT]<>0)
SELECT @totales = (SUM(FLOOR((T0.[TreeQty])))* @DIA)
FROM [dbo].[OITM] T0
WHERE T0.[validFor] = 'Y'
AND T0.[ItemCode] Like @UNI+'-%%' and
SELECT FLOOR((@rentados * 100.00 / @totales)) AS OCUPACION;
END
Y pues es funcional desde SQL cuando lo paso a Crystal para trabajarlo
me sale lo siguiente:
Query Engine Error: ÁDO error Code 0x80040e14
Source Microsoft SQL Server Native Client 11.0
Description: Sintaxis incorrecta cerca de la palabra clave 'CONVERT'
SQL State 4200
Native Error: 156'
y no entiendo que pueda ser
gracias por el apoyo