Home Forums SQL Server 7,2000 T-SQL Evaluating a string arithmatic expression RE: Evaluating a string arithmatic expression

  • Thanks for the feedback; unfortunately, this doesn't help me.

    I need to eval **every value in the column** [Elapsed Time].

    My original post isn't entirely accurate, so let me clarify what I'm trying to do.

    What I REALLY need to do is a query similar to the following:

    select * from

    where [Elapsed Time] < [some time value]

    (or ">", or "=", or whatever comparison the user submits)

    Of course, in order to do the comparison, I need to compare apples to apples; otherwise, it'll do a string comparison (which I DON'T want it to do)!!! In order for me to perform a proper comparison, I need to convert my fields over to a common unit (in this case, seconds).

    So, I'm thinking that if my [Elapsed Time] column stores values of Xh Ym Zs, I can use REPLACE to create a mathematical statement to convert to seconds (X * 3600 + Y * 60 + Z).

    Of course, REPLACE returns a string. The question, therefore, is how do I execute the string.

    Your suggestion is okay for a few values, but I need to eval thousands of rows (over 90,000, at last count).