SQL Server Performance

Problem with dates

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by ohne, Oct 11, 2006.

  1. ohne New Member

    Hello, i have this issue with dates, i dont know how to ask user for a date to make a search in the table

    i have this script:
    SELECT Personal.EmpID AS Reloj, Personal.EmpApPaterno + ' ' + Personal.EmpApMaterno + ' ' + Personal.EmpNombre AS Nombre, Personal.FechaIngreso AS F_Ingreso, wk4_Ultimo_Turno_Empleados_Activos.Turno, wk4_Ultima_Area_Empleados_Activos.Area
    FROM (Personal INNER JOIN (wk4_Ultima_Area_Empleados_Activos INNER JOIN wk4_Ultimo_Turno_Empleados_Activos ON wk4_Ultima_Area_Empleados_Activos.EmpID = wk4_Ultimo_Turno_Empleados_Activos.EmpID) ON Personal.EmpID = wk4_Ultima_Area_Empleados_Activos.EmpID) INNER JOIN wk4_UltimoPuestoC1 ON wk4_Ultimo_Turno_Empleados_Activos.EmpID = wk4_UltimoPuestoC1.EmpID
    WHERE ((Personal.FechaIngreso Between convert(datetime,Fecha_Inicial) And convert(datetime,Fecha_Final)) AND Personal.Activo='S')
    ORDER BY Personal.FechaIngreso DESC;


    but in convert(datetime,fecha_final) and convert(datetime,fecha_inicial) returns an error:
    Msg 243, Level 16, State 1, Line 1
    Type Fecha_Inicial is not a defined system type.
    Msg 243, Level 16, State 1, Line 1
    Type Fecha_Final is not a defined system type.


    I know that those two are not system types, but how can i do the equivalent to the access function:
    Format([Fecha_Inicial],"mm/dd/yyyy") and Format([Fecha_Final],"mm/dd/yyyy")
    that seeks particular dates inputed by useres in a table?
    can somebody help me please?
    thanks

    Love... how is it?
  2. FrankKalis Moderator

Share This Page