消息208,级别16,状态1,过程Transfer_Proc,行20无效的对象名称“库存”。 [英] Msg 208, Level 16, State 1, Procedure Transfer_Proc, Line 20 Invalid object name 'Stock'.
本文介绍了消息208,级别16,状态1,过程Transfer_Proc,行20无效的对象名称“库存”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
消息 208 ,等级 16 ,状态 1 ,过程 Transfer_Proc,行 20
无效对象名称' Stock'。
更改 PROC [dbo]。[Transfer_Proc]
(
@ ID INT = null,
@ Wine_ID int = null,
@ Date nvarchar ( 50 ) = null,
@ Item_Name nvarchar (MAX)= null,
@ Brand nvarchar (MAX)= null,
@卷 数字( 10 , 2 )= null,
@ Unit nchar ( 10 )= null,
@ Quantity numeric ( 1 0 , 2 )= null,
@ Total_volumes numeric ( 12 , 2 )= null,
@ MSG NVARCHAR OUT
)
AS BEGIN
- DECLARE @EMPNO INT
DECLARE @ StockQuntity numeric ( 10 , 2 )
- SELECT @ EMPNO = EMPNO FROM TAD_EMP
SELECT @ StockQuntity = Quantity FROM 股票 WHERE 葡萄酒_ID = @ Wine_ID
if (@ StockQuntity> @Quantity)
BEGIN
更新股票 SET 数量= @ StockQuntity- @ Quantity WHERE Wine_ID = @ Wine_ID
INSERT INTO [转移](Wine_ID, [日期],Item_Name,品牌,数量,单位,数量,Total_volumes) VALUES ( @ Wine_ID , @ Date , @ Item_Name , @ Brand , @ Volumes , @ Unit , @ Quantity , @ Total_volumes )
PRINT ' 项目成功转移'
SET @ MSG = ' Q'
END
ELSE
BEGIN
PRINT ' 库存不可用'
SET @ MSG = ' P'
END
END
声明 @ var_msg nvarchar
exec Transfer_Proc null , 1 ,' dffg',' dfg', ' dfdff', 720 ,' ml', 2 , 2000 , @ var_msg out
Plz给我建议解决这个问题。存储过程执行成功,但它在运行时显示错误...
解决方案
确保Stock表/视图是可用。
Msg 208, Level 16, State 1, Procedure Transfer_Proc, Line 20
Invalid object name 'Stock'.
Alter PROC [dbo].[Transfer_Proc]
(
@ID INT=null,
@Wine_ID int=null,
@Date nvarchar(50)=null,
@Item_Name nvarchar(MAX)=null,
@Brand nvarchar(MAX)=null,
@Volumes numeric(10, 2)=null,
@Unit nchar(10)=null,
@Quantity numeric(10, 2)=null,
@Total_volumes numeric(12, 2)=null,
@MSG NVARCHAR OUT
)
AS BEGIN
-- DECLARE @EMPNO INT
DECLARE @StockQuntity numeric(10,2)
--SELECT @EMPNO=EMPNO FROM TAD_EMP
SELECT @StockQuntity=Quantity FROM Stock WHERE Wine_ID=@Wine_ID
if(@StockQuntity>@Quantity)
BEGIN
UPDATE Stock SET Quantity=@StockQuntity-@Quantity WHERE Wine_ID=@Wine_ID
INSERT INTO [Transfer](Wine_ID,[Date],Item_Name,Brand,volumes,Unit,Quantity,Total_volumes) VALUES(@Wine_ID,@Date,@Item_Name,@Brand,@Volumes,@Unit,@Quantity,@Total_volumes)
PRINT 'Item transfer successfully'
SET @MSG='Q'
END
ELSE
BEGIN
PRINT 'Stock not available'
SET @MSG='P'
END
END
declare @var_msg nvarchar
exec Transfer_Proc null,1,'dffg','dfg','dfdff',720,'ml',2,2000,@var_msg out
Plz give me suggestion to solve this problemm.the store procedure execute successfully but it show in run time error...
解决方案
Ensure that "Stock" table/view is available.
这篇关于消息208,级别16,状态1,过程Transfer_Proc,行20无效的对象名称“库存”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文