Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE FUNCTION ufn_IsWordComprised(@setOfLetters VARCHAR(MAX), @word VARCHAR(MAX))
- RETURNS BIT
- AS
- BEGIN
- DECLARE @why BIT = 0;
- DECLARE @cindex INT = 1;
- DECLARE @cchar CHAR;
- WHILE(@cindex <= LEN(@word))
- BEGIN
- SET @cchar = SUBSTRING(@word, @cindex, 1);
- IF(CHARINDEX(@cchar, @setOfLetters) = 0)
- RETURN @why;
- SET @cindex += 1;
- END
- RETURN @why+ 1;
- END
Advertisement
Add Comment
Please, Sign In to add comment