Home > Blockchain >  ISNULL and Lead Conversion failed when converting date and/or time from character string
ISNULL and Lead Conversion failed when converting date and/or time from character string

Time:11-15

ISNULL(LEAD(R.StartTime,1) OVER ( ORDER BY R.StartTime), 'No Next Lesson') as NextClass

I am not converting anything here, still it throws the same error. Please help.

datatype of R.StartTime is datetime. Tried casting as time, still nothing.

The answers in the other questions didnt help

CodePudding user response:

Answer by @Larnu helped:

if you match the datatype in ISNULL, error is resolved.

"This is telling you the problem; 'No Next Lesson' is not a valid date and time value. ISNULL returns the datatype of the first parameter. One would assume that StartTime is a date and time value, based on the name and the error, and so the failure is then quite obvious"

  • Related