如何在存储过程中显示消息。 [英] How can I display a message in stored procedure.

查看:102
本文介绍了如何在存储过程中显示消息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为插入操作编写存储过程。所以,我需要显示一条成功插入记录的确认消息。任何人都可以帮助我。

Iam writing a stored procedure for insert operation. So, I need to display a confirmation message that record inserted successfully. Any one can help me.

推荐答案

创建程序演示(参数,......)

as

开始

插入table_Name值('a');

打印'插入成功';

结束
Create procedure Demo( parameter,...)
as
begin
insert into table_Name values('a');
print 'inserted successfully';
end


声明@id int

INSERT INTO TableName(条件)

SELECT @ id = SCOPE_IDENTITY()



IF(@id不为空)

SELECT ISNULL(@id,'')[消息]



- 该消息应该在前端宣布为返回参数







HOPE ITS CLEAR
Declare @id int
INSERT INTO TableName(condition)
SELECT @id=SCOPE_IDENTITY()

IF(@id is not null)
SELECT ISNULL(@id,'')[Message]

-- That Message should be declared in frontend as return param



HOPE ITS CLEAR


http://stackoverflow.com/questions/11867551/display-error-消息使用存储过程



见链接
http://stackoverflow.com/questions/11867551/display-error-message-using-stored-procedure

See the link


这篇关于如何在存储过程中显示消息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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