子查询返回多于1的值当子查询跟随=,> =,>,<,< =时,不允许这样做

时间:2017-08-23 07:58:58

标签: sql-server

当我插入员工数据时会发生此错误 子查询返回多于1的值当子查询跟随=,> =,>,<,< =

时,不允许这样做

我试过

INSERT INTO 
    Transaction_Employee(Memployee_id,
                        Emp_bio_id,
                        des_id,
                        Department_id,
                        Unit_id,
                        etype_id,
                        payment_id,
                        Leave_id,
                        joining_date,
                        resign_date,
                        leave_start_date,
                        Bank_id)
VALUES
(
    @memployee,
    @emp_bio_id,
    (SELECT DISTINCT des_id FROM Setup_designation WHERE des_name=@desig),
    (SELECT DISTINCT Department_id FROM Setup_Department WHERE Depart_name=@deprt),
    (SELECT DISTINCT Unit_id FROM Setup_Unit WHERE unit_name=@unit),
    (SELECT DISTINCT etype_id FROM Setup_Enployeetype WHERE ename=@emp_type),
    (SELECT DISTINCT payment_id FROM Setup_Payment_Type WHERE payment_name=@payment),
    (SELECT DISTINCT Leave_id FROM Setup_Leave WHERE leave_name=@leavename),
    @joining_date,
    @resign_date,
    @leave_startdate,
    (SELECT DISTINCT Bank_id FROM Setup_Bank WHERE bank_name=@bank_name)
)

0 个答案:

没有答案