• sej2008 (1/22/2013)


    Once again to bother you,but as per my code which is working fine as per my requirement ,it is an example from good sql book,there was an argument that it should allow at least one raw to update and not multiple updates in salary column which I do not agree and I do not think that there is anything wrong in it.what u have to say.....

    create table emptable (salary int);

    insert into emptable values (10), (20), (30)

    select * from emptable;

    go

    create trigger tgigupdate

    on emptable

    for update

    as

    if update(salary)

    begin

    print 'can not update salary '

    end

    go

    update emptable set salary = salary + 1;

    select * from emptable; --the print statement is issued, all values are updated

    drop table emptable;

    So your requirement says to output 'can not update salary' but update them anyway?

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.