create proc Test(@项目代码 varchar(100))
as
begin
  select U.*
    from 用户角色信息表 U
  where not exists (select 1 from 项目人员角色信息 where 项目代码=@项目代码 and 用户代码=T.用户代码)
end

解决方案 »

  1.   

    select * from 项目人员角色信息
    where 项目代码=你传的值
    and (用户代码,角色代码) not in (select 用户代码,角色代码 from 用户角色信息表)
    可以吗?
      

  2.   

    and (用户代码,角色代码) not in (select 用户代码,角色代码 from 用户角色信息表)
    -----没有这样的写法吧!!??
      

  3.   

    我一直混oracle的我想问下MS-SQL Server 怎么写这样的
      

  4.   

    select * from 项目人员角色信息
    where 项目代码=你传的值
    and (用户代码,角色代码) not in (select 用户代码,角色代码 from 用户角色信息表)
    可以吗?========================
    这个肯定不行
      

  5.   

    我试一下scmail81(琳·风の狼(修罗)) ( ) 信誉:100    这位兄弟的写法。
    先谢谢各位了。
      

  6.   

    create proc Test(@项目代码 varchar(100))
    as
    begin
      select U.*
        from 用户角色信息表 U
      where not exists (select 1 from 项目人员角色信息 where 项目代码=@项目代码 and 用户代码=T.用户代码)
    end==========
    这种写法也有问题。