如何按名称执行搜索过程

时间:2020-04-05 23:22:22

标签: sql sql-server

我在创建程序时遇到麻烦。

我想要一个使用like按名称搜索的过程,但是我不能将其与变量一起使用。

脚本

alter Procedure [dbo].[spPesquisaTudo](
    @Nome varchar(150)
--, @CPF varchar(14)
)
  As Begin

Set NoCount on;

Select 

    clientes.ClienteId
,   clientes.Nome
,   clientes.CPF
,   clientes.Endereco
,   clientes.Whatsapp
,   clientes.Telefone
,   clientes.DataCriacao
,   clientes.DataModificacao

From dbo.Clientes clientes

Where clientes.Nome like '%Nome%'

End

enter image description here

1 个答案:

答案 0 :(得分:0)

如果您想根据用户输入进行通配符搜索,或者在运行该过程时用户可以使用'%sth%'之类的名称,则可以使用局部变量。但我认为局部变量将是一个不错的选择。

function getData () {
    fetch("https://corona.ps/API/summary")
     .then(res => res.json())
     .then(data => console.log(data)) // will log js object
     .catch(err => console.log(err))
}
相关问题