sql中没有记录级的权限控制.可以考虑通过其他手段限制
例如写触发器来限制
或者是设置两个表, 一个表只保存最近可以修改的数据, 另一个表保存验证后的数据, 在保障数据访问的统一上, 通过视图关联两个表.

解决方案 »

  1.   

    SQL Server只有字段级,即列级权限,而没有行级,即记录级权限控制。使用触发器可以实现楼主的要求。
      

  2.   

    --如下语句执行一下看看if object_id('test') is not null drop table test
    go
    create table Test
    (
    months int,
    employeeid int,
    salary int
    )
    insert into Test
    select 1,1,100 union all
    select 1,2,200 union all
    select 1,3, 300 union all
    select 2,1,200 union all
    select 2,2,240 union all
    select 2,3,400
    select * from Test
    go
    create trigger Tri_Limit on Test
    for Update
    as
    if (select min(months) from inserted)<>(select max(months) from Test)
    begin
    print 'Updating Not Allowed'
    rollback transaction
    end
    go
    select * from test where months=2 and employeeid=2
    update test
    set salary=400
    where months=2 and employeeid=2
    go
    select * from test where months=2 and employeeid=2
    go
    select * from test where months=1 and employeeid=2
    update test
    set salary=400
    where months=1 and employeeid=2
    go
    select * from test where months=1 and employeeid=2
    go
    drop table Test
      

  3.   

    关键是公司有800多人,每一个有20多列数据(姓名,序号,银行帐号,月份,岗位工资,绩效工资,职务补贴,医疗补贴,工龄补贴,养老金  ............   累计实发)
    另一个问题是,如果上述"LouisXIV(夜游神)"代码可行,直接拷贝在"视图"运行吗?