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

Trigger count records

Status
Not open for further replies.

jvande

MIS
Jun 6, 2001
115
US
I would like to write a trigger to do something if the record count for that table is > 2 records. Any suggestions?
 
I am not really know what do you want, but I think you need raising one action when number of records greater than 2.
It will change when you insert record, that mean you must create a trigger for insert action as follows:

CREATE TRIGGER <trigger_name>
ON <table_name>
FOR INSERT
AS
BEGIN
declare @count numeric
select @count =count(*) from <table_name>
if @count >2 ....

END


Good luck for you.
Uyen Chi Uyen Chi
Software developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top