日期:2014-05-19  浏览次数:20379 次

存储过程能这样写吗?
create   PROCEDURE   App_Customers_Update
@CustomerID   int,
@Phone   nvarchar(32),
@FamilyTypeID   int,
@IDCardNo   nvarchar(32),
@CustomerLevel   int,
@FamilyTypeName   nvarchar(64)


AS
Update   Customers
set   Phone   =   @Phone,FamilyTypeID   =   (select   FamilyTypeID   from   FamilyType   where   FamilyTypeName   =   @FamilyTypeName),IDCardNo   =   @IDCardNo,CustomerLevel   =   @CustomerLevel
where   CustomerID   =   @CustomerID
RETURN


------解决方案--------------------
应该可以,如果出错把select FamilyTypeID from FamilyType where FamilyTypeName = @FamilyTypeName赋值给一个变量,然后FamilyTypeID=变量
------解决方案--------------------
跟踪一下@FamilyTypeName参数的值
然后在查询分析器下运行这句select FamilyTypeID from FamilyType where FamilyTypeName = 监视得到的值,看看什么结果