Quantcast
Viewing all articles
Browse latest Browse all 16

Conversion failed when converting date and/or time from character string

I figured it out. Both have to be cast as sql_variant.

select v.name, v.value,

      case

             whenisdate(v.value)= 1and v.valueisnotnullandrtrim(ltrim(v.value))<>''thencast(cast(v.valueasdatetime)assql_variant)

             elsecast(cast(v.valueasvarchar(1000))assql_variant)

      end

from tickets tjoin vVariablesForTickets von v.process_id= t.process_id


Viewing all articles
Browse latest Browse all 16

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>