We help IT Professionals succeed at work.

MS SQL: Create User Function to Remove Long Words

skij
skij asked
on
124 Views
Last Modified: 2018-04-06
I want a user function that will remove all words longer than 7 characters.

For example:
Select dbo.RemoveLongWords('Hello Supercalifragilisticexpialidocious 01234567890 World 123 @#$!@# pneumonoultramicroscopicsilicovolcanoconiosis')

Open in new window

Should return:

Hello World 123 @#$!@#

ALTER Function [dbo].[RemoveLongWords](@Temp NVarChar(MAX))
Returns NVarChar(MAX)
AS
Begin

...???...

End

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2013

Commented:
Is it a homework?

Author

Commented:
@chaau: I've been working longer than you have been living :-)  It is not homework.
CERTIFIED EXPERT
Top Expert 2013

Commented:
I don't care, in fact, I don't care at all. Good luck with your life with such attitude
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
This works perfectly, thanks!