Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you set a value within a trigger?

Status
Not open for further replies.

cjohnson6

Technical User
Jul 19, 2000
21
0
0
US
CREATE TRIGGER [Trig_CheckReleased] ON dbo.t_candidate1
FOR INSERT, UPDATE

AS
My name is Claude Johnson and I have attached a new trigger I've created below and what I am trying to do within this trigger is call a value through a SELECT statement and then if a particular condition is TRUE, I would set or 'turn on' a field based on this result.
So my question is, how can I (based on my synatx below), set the field 'release' to a status of ON ?? The default value of the field 'release' in my table, t_candidate1 is '0'.

Can this be done and if so, what is the basic syntax to do so?

Thank you in advance,
Claude
------------


Declare @release smallint,
@old_release smallint

select @release = release from INSERTED
select @old_release = release from t_candidate1

if @old_release = 0
begin
if @release = 1
begin

??set release field to ON if this condition is TRUE

end

end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top