How to use a LIKE statement inside an IF statement?
Posted
by user322652
on Stack Overflow
See other posts from Stack Overflow
or by user322652
Published on 2010-04-21T20:19:40Z
Indexed on
2010/04/21
20:23 UTC
Read the original article
Hit count: 187
sql
|sql-server-2005
I need to be able to check if a variable has a certain string of text inside it. Here's what I have now:
--This sample always goes to the ELSE block.
IF( @name LIKE '%John%' )
BEGIN
--do one thing
END
ELSE
BEGIN
--do the other thing
END
© Stack Overflow or respective owner