all groups > sql server programming > april 2005 >
You're in the

sql server programming

group:

Trigger question



Re: Trigger question --CELKO--
4/30/2005 11:38:29 AM
sql server programming: Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are. Sample data is also a good idea, along with clear
specifications.
Trigger question RD
4/30/2005 1:39:34 PM
With a variable declared and its value found by a select statement

Say DECLARE @MyVar INT
Now find variable Myvar in MyTable based on a foreign key value for
instance
Select @Myvar = Myvar From MyTAble where ID = (select IDFK from deleted)

Now I want to assign @MyVar to a field in the current record being updated.
Whats the syntax for that?

I tried Update deleted set MyValue = @Myvar but I get an error when checking
the syntax. saying fields in deleted can not be updated.

Can anyone help?

Would be greatly appreciated.

Best regards,

RD

AddThis Social Bookmark Button