USING Check Constraint - Avoid halting the process and ERROR

  • Hi

    I like to create a Check Constraint on a column that allows only A-Z, a-z, 0-9 in the first character of the column. I got this part working just fine.

    THE PROBLEM:

    The requirement is to place a null in the column if the above Check Constraint is violated and proceed with rest of the rows instead of throwing an error and stopping the process.

    Is this doable using Check Constraint. I would like not to use trigger or function or stored procedure instead of Check Constraint?

    Regards

  • Without the table definition, some sample data, and your T-SQL statement (Refer to the first link in my signature block for the complete format, etc., to receive tested help) the only assistance I can suggest to you is .. to examine the Try .. Catch construct

    BEGIN TRY

    { sql_statement | statement_block }

    END TRY

    BEGIN CATCH

    [ { sql_statement | statement_block } ]

    END CATCH

    Read here for additional sample code - and an explanation of try .. catch construct as well as it's limitations.

    http://technet.microsoft.com/en-us/library/ms179296(SQL.90).aspx

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply