-1

I'd like to be able to check if a parameter contains a particular word.

For example:

@ContactName VARCHAR(50)

IF CONTAINS(@ContactName, 'Temp')
marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425

1 Answers1

2
if CHARINDEX('Temp',@ContactName) > 0

CHARINDEX() This function is used to search for a specific word or a substring in an overall string and returns its starting position of match. In case no word is found, then it will return 0 (zero).

Tom
  • 153
  • 11
  • 1
    Add an explanation to what this does for the OP, so that they can understand the answer. – Larnu Aug 15 '19 at 12:14