Advertisement
Guest User

Untitled

a guest
Oct 8th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.33 KB | None | 0 0
  1. CREATE FUNCTION ufn_IsWordComprised (@setOfLetters VARCHAR(20), @word VARCHAR(20))
  2. RETURNS BIT
  3. AS
  4. BEGIN
  5.     IF (SUBSTRING(@word,1,1) LIKE '[' + @setOfLetters + ']')
  6.     BEGIN
  7.         SET @word = SUBSTRING(@word,2,LEN(@word)-1)
  8.         RETURN dbo.ufn_IsWordComprised (@setOfLetters,@word)
  9.     END
  10.  
  11.     IF (LEN(@word) = 0)
  12.         RETURN 1
  13.     RETURN 0
  14. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement