记录未在存储过程中更新 [英] Record was not Updated in Store procedure

查看:65
本文介绍了记录未在存储过程中更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有存储程序---

 创建  proc  [dbo]。[spUpdateEstmateDetail] 

@ FileCode varchar 50
@ WorkBriefName varchar 50
@ WorkDetailedName varchar 200
@ EstimationDate datetime
@ WID INT
@ MID INT
@ EstimatedQuantity float
@ Unit varchar 50
@ EstimatedAmount float
@ EstimateID INT
@ IsUpdated INT 输出


AS
IF NOT EXISTS SELECT EstimateID FROM 估计 WHERE FileCode = @ FileCode)
BEGIN
print @ EstimateID
更新估算
SET FileCode = @ FileCode,
WorkBriefName = @ WorkBriefName,
WorkDetailedName = @ WorkDetailedName,
EstimationDate = @ EstimationDate,
WID = @ WID ,
MID = @ MID,
EstimatedQuantity = @ EstimatedQuantity,
单位=单位,
EstimatedAmount = @ EstimatedAmount
WHERE EstimateID = @ EstimateID
print @ EstimateID

SET @ IsUpdated = 1
END
ELSE
BEGIN
SET @ IsUpdated = 2

- ---------------- ------

我的 < span class =code-keyword>其中数据.... 。希望 更新相关的记录< span class =code-keyword> to table data coulumn

我的 ...估计
EstimateID FileCode WorkBriefName WorkDetailedName EstimationDate EstimatedQuantity单位EstimatedAmount WID MID
43 f120 tryr rtee 2013-11-11 00:00:00。 000 12 1 215 1 1
45 f122 gt ytr 2013-01-02 00:00:00。 000 15 150 1500 31 2
44 f123 gtr ytr 2013-11-01 00:00:00。 000 121 13 1500 31 2


- -------------
我怎么能调试 过程 其中 < span class =code-keyword>
个错误
所以这里查询 商店 procedure 执行成功...但 update 记录如何 alter SP中哪些是哪个?错误其中我受委屈

解决方案

请试试这个,



在storeprocedure上放置断点

选择exec storeprocedurename

然后点击Run Button not Execute

I have store procedure ---

Create proc [dbo].[spUpdateEstmateDetail]
(
	@FileCode varchar(50)
   ,@WorkBriefName varchar(50)
   ,@WorkDetailedName varchar(200)
   ,@EstimationDate datetime
   ,@WID INT
   ,@MID INT
   ,@EstimatedQuantity float
   ,@Unit varchar(50)
   ,@EstimatedAmount float
   ,@EstimateID INT
   ,@IsUpdated INT OUTPUT
   
)
AS
IF NOT EXISTS(SELECT EstimateID FROM Estimate WHERE FileCode=@FileCode)
BEGIN
    print @EstimateID
	UPDATE Estimate 
			SET FileCode=@FileCode,
				WorkBriefName=@WorkBriefName,
				WorkDetailedName=@WorkDetailedName,
				EstimationDate=@EstimationDate,
				WID=@WID,
				MID=@MID,
				EstimatedQuantity=@EstimatedQuantity,
				Unit=Unit,
				EstimatedAmount=@EstimatedAmount
				WHERE EstimateID=@EstimateID
				print @EstimateID
            
	SET @IsUpdated=1
END
ELSE
BEGIN
	SET @IsUpdated=2

------------------------

and my table where the data .....and want to update records related to table data coulumn

My table ... Estimate
EstimateID  FileCode    WorkBriefName   WorkDetailedName    EstimationDate  EstimatedQuantity   Unit    EstimatedAmount WID MID
43  f120    tryr    rtee    2013-11-11 00:00:00.000 12  1   215     1   1
45  f122    gt      ytr     2013-01-02 00:00:00.000 15  150 1500    31  2
44  f123    gtr     ytr     2013-11-01 00:00:00.000 121 13  1500    31  2


---------------
how can i debugged in the Store procedure that where is errors
So here query of Store procedure execute successfully ...but not update the records so how can alter in SP which find the error where i am wronged

解决方案

Please try this,,

place break-point on storeprocedure on top
select exec storeprocedurename
then click Run Button not Execute


这篇关于记录未在存储过程中更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆