-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
  • 732,580
  • 175
  • 1,330
  • 1,459
Lee Stevens
  • 25
  • 1
  • 6

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
  • 163
  • 1
  • 11