存储过程的结构 [英] structure of stored procedure

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

问题描述

我必须将一个变量传递给存储过程并将该值与数据库表值匹配,并且还要计算该记录不会超过1并返回该特定列数据。

i have to pass a variable to stored procedure and match the value with database table value and also count that record will not more than 1 and return that particular column data.

推荐答案





检查一下...... Sql Server - 如何在Sql server中编写存储过程 [ ^ ]





另外,根据您的要求。找到以下结构。



Hi,

Check this ...Sql Server - How to write a Stored procedure in Sql server[^]


Also, as per your req. find below structure.

CREATE PROC PR_TEST
(
@PA_VAR1 VARCHAR(100)
)
AS
BEGIN

DECLARE @CNT INT



SELECT @CNT=COUNT(*) FROM YOUR_TABLE WHERE COL=@PA_VAR1

IF @CNT > 1
BEGIN

 SELECT 'VALID' 

END
ELSE
BEGIN

  SELECT 'INVALID' 

END

END





希望以上将帮助您。





干杯



Hope above will help you.


Cheers


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

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