• instead of returning a zero when there's an error, just throw a sqlexception, and that will return the full error message, so you can track it down completely.

    if it's a logic error(if.. else return 0), create a string with some diagnostic info, and raise a sql exception with that information.

    i could help with some peer review if you want to paste the body of your CLR function .

    Try {

    // code here

    }

    catch (SqlException odbcEx) {

    // Handle more specific SqlException exception here.

    }

    catch (Exception ex) {

    // Handle generic ones here.

    }

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!