I'm sure there's a better way ... but here's one solution:
CREATE FUNCTION fn_GetSeconds(@hhmmss int)
RETURNS int
As
Begin
DECLARE @j-2 varchar(6)
SET @j-2 = right('000000' + cast(@hhmmss as varchar(6)), 6)
RETURN substring(@j, 1, 2) * 24 * 60 + substring(@j, 3, 2) * 60 + substring(@j, 5, 2)
End
Go