Tuesday, 20 March 2012

How to Insert a particular Number of Records/ rows in a table

create trigger LimitTable
on student
after insert
as
    declare @tableCount int
    select @tableCount = Count(*)
    from student
    if @tableCount >15
    begin
        rollback
    end
go

Here Student is the Table Name and LimitTable is the Trigger Name....

No comments:

Post a Comment