before insert trigger

  • Hi,

    I've a table with run_time column with data type of datetime and description column with data type of nvarchar (1024)

    i need to write a before trigger to check if the run_time and description exists in the table then rollback.

    i can't put a unique index to both columns because i need to filter the run_time column that will compare to the date only and not the time.CONVERT(NVARCHAR(20),RUN_TIME,103)

    how can i accomplish this?

    THX

  • Can you add a computed persisted column based on the run_time column to hold the date value only and add a unique constraint to it?

    Probably a better performing solution than the trigger approach...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

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

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