从表中选择哪里不起作用? [英] select from table where is not working?

查看:47
本文介绍了从表中选择哪里不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码可以过滤表格中的数据

I have this code for filtering data from table

create proc [dbo].[DataDetailsFilter_proc]

@filter varchar output

as
set nocount on

SELECT *
FROM DataDetails
WHERE FirstName = @filter



但这不起作用

它什么也没回来

FirstName是列的名称,当我而不是@filter时,键入此

WHERE FirstName =``MYNAME''

然后它可以工作,但是我需要输入该参数



but it''s not working

it gets back with nothing

FirstName is the name of the column and when I instead of @filter type this

WHERE FirstName = ''MYNAME''

then it works, but I need to type in that parameter

推荐答案

那是因为您的参数varchar ..您必须设置varchar.size,否则它将只需要一个字符..

试试这个.

Thats because your parameter varchar.. You have to set the size of varchar.Else it will take only one character..

Try this.

create proc [dbo].[DataDetailsFilter_proc]
 
@filter varchar(100) output
 
as
set nocount on
 
SELECT *
FROM DataDetails
WHERE FirstName = @filter


您好,

您不能在Select语句中使用存储过程的语法不正确,

执行DataDetailsFilter_proc``MYNAME''

会起作用.
Hi,

You cann''t use Stored Procedure in Select statement its incorrect syntax,

Exec DataDetailsFilter_proc ''MYNAME''

it will work.


它对我有用.它应该可以正常工作
it works for me though. It should be working


这篇关于从表中选择哪里不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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