April 4, 2002 at 10:26 am
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.
April 4, 2002 at 2:54 pm
How about creating a trigger?
April 4, 2002 at 7:18 pm
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)
April 5, 2002 at 7:59 am
Thanks Guys.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply