Friday, September 2, 2022

View convert varchar to datetime, if date is in varchar format in view -SQL

VARCHAR is not support greater than symbol and our datetime field is in varchar in view, so below is the solution:-

We have to convert VARCHAR into DATETIME format

SELECT 

  where 

                                Training_Partner_id='ESDM-HR-TP-000379' AND

                                Total_Certified > 0 AND Total_Placed>=( CASE WHEN ( CONVERT(DATETIME, Batch_Start_date,103) >='2022/04/01')

THEN

(CASE WHEN max_student_allowed % 2 = 0 

THEN ((max_student_allowed/2))

ELSE ((max_student_allowed/2)+1)

END )

ELSE

(0)

END)

No comments:

Post a Comment