存储过程执行中的错误 [英] Error in Stored Procedure execution

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

问题描述

我正在尝试为我的数据库中的Department表执行以下存储过程,这是我遇到的错误.
消息208,级别16,状态6,过程Proc_Department_Select,第24行无效的对象名称"dbo.Proc_Department_Select".

有人可以帮我吗?

I am trying to execute the following Stored Procedure for the Department table in my DataBase for which i am getting this error.
Msg 208, Level 16, State 6, Procedure Proc_Department_Select, Line 24 Invalid object name ''dbo.Proc_Department_Select''.

Can anybody help me with this?

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[Proc_Department_Select] 
	@DepartmentID as int=null	
AS
BEGIN	
SET NOCOUNT ON;
IF (@DepartmentID is null or @DepartmentID=0)
BEGIN  
SELECT  d.DepartmentID,
	d.DepartmentName,
	d.PhoneNo
FROM Department d
END

ELSE
BEGIN
SELECT  d.DepartmentID,
	d.DepartmentName,
	d.PhoneNo
FROM Department d
WHERE d.DepartmentID = @DepartmentID
END
END
GO


我一直无法找到错误的原因,将不胜感激所有帮助.. !!

谢谢.


I''ve been unable to locate the cause of the error and would appreciate all help..!!

Thank you.

推荐答案

检查您的proc的许可.这是可能性之一.
Check the permission of your proc. It is one of the possibilities.


cnjadhav写道:
cnjadhav wrote:

ALTER 过程[dbo].[Proc_Department_Select]

ALTER PROCEDURE [dbo].[Proc_Department_Select]


将单词"ALTER"更改为"CREATE"!

当前,该存储过程在您的数据库中不存在.第一次,您需要使用CREATE.到达该位置后,对进一步的编辑(如果有)使用ALTER.


Change the word ''ALTER'' to ''CREATE''!

Currently, the stored procedure doesn''t exists in your database. First time you need to use CREATE. Once it is there, use ALTER on further edits if any.


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

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