问题描述
HI
我的问题如下。我有一个表,其中包含ID为ID字段,以ST和#STA开头。我想将ID字段保存在变量中,然后IF以ST开头我想运行存储过程,如果它以#STA开头我想运行不同的存储过程。我怎么做到这一点??
我试着按照以下方式做到这一点:
@id :=ST或#STA
IF @id LIKE#STA
THEN
做什么
结束如果
我有点失落,有人可以帮忙吗?
HI
My problem is as follows. I have a table that has an "ID" field with id''s that begin with "ST" and "#STA". I want to save the ID field in a variable and then "IF" it begins with "ST" i want to run a stored procedure else if it begins with "#STA" i want to run a different stored procedure. How do i accomplish this??
I tried to do it the following way:
@id := "either ST or #STA"
IF @id LIKE "#STA"
THEN
"DO SOMETHING"
END IF
Im a bit lost, can someone help?
推荐答案
IF @id LIKE "#STA%"
并且以#STA开头的任何字符串都意味着DO SOMETHING
已执行。
and any string that begins with "#STA" would mean "DO SOMETHING"
is executed.
这篇关于使用“LIKE”确定变量的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!