存储过程的问题 [英] problem with stored procedure

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

问题描述

我想显示表格中每行的列子值,但是存储的peocedure在执行时返回0,列子类型为varchar



SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER程序[dbo]。[ subcat]



@main varchar(max)



as

begin

从类别中选择sub,其中main ='@ main'



end

i want to show value of column sub for each row in table,but stored peocedure returns 0 while executing, column sub has type varchar

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[subcat]

@main varchar(max)

as
begin
select sub from category where main='@main'

end

推荐答案

删除单引号,使用如下

Remove the single quotes, use like below
select sub from category where main=@main


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

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