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

问题描述

我将@AccountCode作为参数传递给我的存储过程.如果AccountMaster表中不存在该AccountCode,则必须打印一条消息,说明数据不可用".

I''m passing @AccountCode as the parameter to my stored procedure. If that AccountCode does not exist in the AccountMaster table, the a message must be printed saying ''The data is unavailable''. How do i do this?

推荐答案

IF EXISTS (Select AccountID(Primary Key) From AccountMaster Where AccountCode = @AccoundCode)
BEGIN
  -- your logic
END
ELSE
BEGIN
 -- your message
END


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

06-19 04:53