TSQL Logic test if DateTime2 variable has a Date

lundi 20 avril 2015

Will the Statement cover for equal for an IsDate function in VBA?
if @Dt_APD_WithDrawn_Sub is not Null

The default is null. But, it is possible that a user enters a date, then highlights and deletes the date due to a mistake. This is part of a UDF.

Basically, the field needs to be checked to see if it contains a date or not.


Spent time looking up many post

Code:

                if @Dt_APD_WithDrawn_Sub is not Null
                        Begin
                                Set  @APDResult='Withdrawn'
                        end
                Else  -- With the two before completed - the multiple values run through a nested Case will determine the outcome
                        Begin
                                Set @Dt_APD_Sub =        (SELECT TOP 1 tblAPD_Fed_ST_CO.Dt_APD_Sub
                                                                        FROM tblAPD_Fed_ST_CO
                                                                        WHERE (((tblAPD_Fed_ST_CO.ID_Wells)=@ID_Wells) AND
                                                                          (tblAPD_Fed_ST_CO.txtFedStCo)='FED')  AND (tblAPD_Fed_ST_CO.lngID_APD_Status In(1,2,3,4))
                                                                        ORDER BY tblAPD_Fed_ST_CO.Dt_APD_Sub DESC
                                                                        )

TSQL Logic test if DateTime2 variable has a Date

0 commentaires:

Enregistrer un commentaire

Labels