sql server - Converting string with minutes over 60 into time datatype causes an error -
declare @data table (working_hours nvarchar(10)); datatable insert @data (working_hours) select '0:10'; insertion values insert @data (working_hours) select '1:90'; insert @data (working_hours) select '0:10'; insert @data (working_hours) select '0:10'; --select working_hours @data; *this state work* --select @data lion ; state work select convert(int, (datepart(hour, convert(time, q1.working_hours)) * 60) + datepart(minute, convert(time, q1.working_hours))) lion @data q1;
results in conversion error - want convert min nvarchar
, convert int calculate sum in sap report
how can denominate work through way..
assuming that's hours , minutes problems data (90 minutes), can without using time -datatype of course doesn't allow kind of time:
select convert(int, left(working_hours, charindex(':', working_hours)-1)) * 60 + convert(int, substring(working_hours, charindex(':', working_hours)+1,10)) @data
Comments
Post a Comment