使用like运算符的存储过程[错误] [英] stored procedure using like operator [error]

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

问题描述

大家好!



我正在使用like运算符创建一个存储过程,我的命令中有一个错误,即表名是tblsummaryIMPORT ..这个命令能够改变从具有贷款和贷款价值的promocode触发的状态,所以我使用像运营商所以这里是我没有贷款促销代码的代码:



Hi everyone!

I am creating a a stored procedure using like operator and i have an error in my command which is the table name is tblsummaryIMPORT.. in doing this command that will able to change the status that triggers from the promocode having its value with loan and with loan so i've use like operator so here's my code for without loan promocode:

CREATE PROCEDURE [dbo].[promocodestatus]

select * from tblsummaryIMPORT where promocode like 'without loan' 
update tblsummaryIMPORT set status = 'for payment' where set status=@status;



但在这段代码中,我面临错误,所以请帮助...提前感谢


yet in this code i face error here so please help... thanks in advance

推荐答案

我怀疑你实际上想要说的话:

I suspect that you actually want to say something along the lines of:
UPDATE tblsummaryIMPORT SET status = 'for payment' WHERE status=@status AND promocode LIKE '%without loan%'

在UPDATE之前有一个SELECT语句不会将更新的记录限制为SELECT返回的记录 - 这两个操作是独立的。

另外 promocode LIKE'付款' pr完全相同omocode ='for payment',因为搜索文本不包含通配符。 '%'是'任意数量的任意字符'的SQL通配符,其方式与'*'对于Windows文件名相同

Having a SELECT statement before the UPDATE does not restrict the records updated to those returned by the SELECT - the two operations are independent.
In addition promocode LIKE 'for payment' is exactly the same as promocode = 'for payment' as the search text contains no wild cards. '%' is the SQL wildcard for 'any number of any character' in the same way that '*' is for windows filenames


这篇关于使用like运算符的存储过程[错误]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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