SQL, How to convert VARCHAR to bigint?

sql, sql-server

Solution

This is the answer

(CASE
  WHEN
    (isnumeric(ts.TimeInSeconds) = 1) 
  THEN
    CAST(ts.TimeInSeconds AS bigint)
  ELSE
    0
  END) AS seconds

Problem

I have a field that is `VARCHAR(6)` I am trying to insert it into another table of type `bigint` it is giving me an error (Error Converting from data type varchar to bigint here is what i am doing ``` CONVERT(bigint, seconds) as seconds ``` Can anybody help with this issue?

Original source