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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trigger question

Status
Not open for further replies.

griffitd

Programmer
Aug 20, 2002
189
GB
Hi

I have the following code in an update trigger

ALTER Trigger [dbo].[Upd_TIIssueQty]
On [dbo].[TrimIssued] FOR UPDATE NOT FOR REPLICATION
AS
Declare @MyAddQty decimal(10,2)
Declare @MyBOMItemCode int
Declare @MyWorkareaCode int
Declare @MyStyleCode int
Declare @MyPackCode int
Declare @MyGarmCode int
Declare @MySizeCode int
Declare @MyLocation varchar(20)
Declare @MyNewIssueQty decimal(10,2)
Declare @MyNewIssueRetQty decimal(10,2)

Declare @MyOldIssueQty decimal(10,2)
Declare @MyOldIssueRetQty decimal(10,2)

Declare @MyRowCount int

SELECT @MyRowCount=COUNT(*) FROM INSERTED

what will @Myrowcount be when an update occurs? does the from inserted use the updated records

Thanks in advance

 
You will get the number of updated records.

INSERTED will contain the new values
DELETED will contain the old values

Both will have the same number of records.


[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top