级联参数不适用于多选

时间:2013-12-10 21:00:29

标签: sql

我需要帮助来解决这个问题。我的报告适用于单值但不适用于多值。报告的参数是级联的。错误是这样的:

"the Select list for the insert statement contains more items than the insert list. The number of select values must match the number of INSERT columns. Incorrect syntax near ','."

查询如下:

IF @Action = 'U' 
BEGIN 
    UPDATE  p     
    Set P.Employee_uno = e.Empl_uno, 
    p.Employee_name = E.employee_name,
    p.email = E.email
            FROM            BO_custom.dbo.property_coorindators P cross JOIN
                 BO_live3.dbo.hbm_persnl E 
            WHERE        P.employee_uno = @ChangeEmpl AND p.offc_code = @Offc AND e.empl_uno = @employee 
END

If @Action = 'I'
Begin
INSERT INTO [BO_CUSTOM].[dbo].[Property_Coorindators]
       ([Employee_Uno]
       ,[Employee_Name]
       ,[Offc_Code]
       ,[Email])
    Select @employee, employee_name, @Offc, EMAIL 
from BO_live3.dbo.HBM_persnl E
where E.empl_uno = @employee
End

If @Action = 'X'
Begin
    Delete from [BO_CUSTOM].[dbo].[Property_Coorindators]
    where offc_code = @Offc 
    and @ChangeEmpl = employee_uno

End 


SELECT *  
    FROM            BO_custom.dbo.property_coorindators P
    WHERE        offc_code = @Offc

0 个答案:

没有答案