这条件有什么问题?

时间:2014-01-31 06:51:27

标签: sql-server tsql

ALTER PROCEDURE EditEmployee (

@RefNo integer ,
@EmpId nvarchar ,
@Name ntext ,
@Designation ntext ,
@Qualification ntext ,
@Gender ntext  ,
@DOB date ,
@Address text ,
@Email ntext ,
@Phone decimal )
        as 
        begin
        UPDATE  Emp_Sample 
        SET RefNo=@RefNo,Name=@Name,Designation=@Designation,
            Qualification=@Qualification,Gender=@Gender,
            DOB=@DOB,Address=@Address,Email=@Email,
            Phone=@Phone
           where EmpId=@EmpId

       END

2 个答案:

答案 0 :(得分:2)

您需要包含@EmpId nvarchar尺寸。

ALTER PROCEDURE EditEmployee (

@RefNo integer ,
@EmpId nvarchar(30) ,

nvarchar [ ( n | max ) ]

如果在数据定义或变量声明语句中未指定n,则默认长度为1.如果未使用CAST函数指定n,则默认长度为30.

HERE

答案 1 :(得分:0)

我认为你有Cast问题

试试这个

WHERE EmpId = CAST(@EmpId AS INT)