Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Conversion failed when converting the varchar

$
0
0

This line returns the above error. The value in the database is an in, but I am putting it into a text label, (hours), so why does it fail?   The value of multi  (1 or 0) determines whether you divide the number of minutes into days, hours an min or just hours and min. but the result should be characters.

Error = Conversion failed when converting the varchar value '1:0 (h:m)' to data type int.

, CASE m.multi WHEN 1 then CAST(m.elapsedtime/1440 as varchar) + 
	':' + CAST(m.elapsedtime % 1440/60 as varchar) +
	':' + CAST ((m.elapsedtime %1440)%60 As varchar) + ' (d:h:m)' 
ELSE CAST( m.elapsedtime/60 AS varchar) + 
	':' + Cast(m.elapsedtime % 60 as varchar(50)) + ' (h:m)' END  AS  [Total Time] 



Viewing all articles
Browse latest Browse all 8428

Trending Articles



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