Using the Default Object or any other way

  • Providing the following information:-

    SQL Server: 7.0

    Database Name : TestDB

    Table Name: TestTBL (Field A and Field B)

    The Qestion:

    How can I set the Default value for field B to 'Y' when field A='F', and set field B to 'N' when field A='M'? I would like the value to be set during Insert.

  • How about creating a trigger?

  • Yeah with SQL7 your limited to a trigger or stored procedure. A trigger is though your best bet as direct insterts will be handled as well.

    Do it based on FOR INSERT using a case statement for you SET B = CASE....END looking to the inserted table where data enters.

    Hope this helps.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Thanks Guys.

Viewing 4 posts - 1 through 3 (of 3 total)

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