Hi EveryOne,
I'm trying to create a Datawindow from an stored procedure, I've done it lots of times but this one is not working properly.
The stored procedure is in an SQL Server Database.
As always, I do a NEW - Datawindow - Grid - Stored procedure.
It shows me all the stored procedures in the DB, and when I select the one I want, it gives me an error:
"Error converting a character string in data and/or time"
I've activate the trace an the log file shows the sentence used to build the DW:
execute dbo.InformeRegistroAnalisisActuacion;1 @DesdeProveedor = '0', @HastaProveedor = '0', @RangoProveedores = '0', @DesdeFinca = '0', @HastaFinca = '0', @RangoFincas = '0', @DesdeCultivo = 0, @HastaCultivo = 0, @RangoCultivos = '0', @RangoTipoAnalisisFinca = '0', @RangoTipoAnalisisCultivo = '0', @DesdeFecha = '1990-07-14 00:00:00.000', @HastaFecha = '1990-07-14 00:00:00.000', @RangoFechas = '0', @DesdeTecnico = '0', @HastaTecnico = '0', @RangoTecnicos = '0', @ObtenerEsquema = 0
The problem is in the Datetime format that must be yyyymmdd and in the variable @RangoFechas, that doesn't like to be 0 it seems.
The question is, can I create the Datawindow assigning manually the data, and then changing it when I want to use it?
If I rune the procedure from the code, It works ok:
Declare procedimiento Procedure For InformeRegistroAnalisisActuacion '', '', '', '', '','',0,0,'','', '1067', NULL, NULL, '', '','', '',1
USING sqlsrv;
EXECUTE procedimiento;
But I prefer to populate the DW directly than doing all the stuff...
Is this possible?
The DW is now created.
The stored procedure creates the table result columns dinamically depending on the entry values and the field @RangoFechas = '0' should be ' '. The owner has made a simple change and it is working now.
Thank you for everything!!