• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1578
  • Last Modified:

Function to remove apostrophes ( ' ) from a string

Does anyone have a handy-dandy SQL2K User-defined function to remove any apostrophe's from a string?

SELECT @INSD_LAST_NAME = dbo.SomeFunction(pers.PERS_LAST_NAME)
FROM PERS_PERSON pers
WHERE blah blah blah

If pers.PERS_LAST_NAME is O'Malley, then @INSD_LAST_NAME would be assigned the value of OMalley.

TIA
Jim
0
Jim Horn
Asked:
Jim Horn
1 Solution
 
wittysloganCommented:
replace(PERS_LAST_NAME,'''','')

should do it.  
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorAuthor Commented:
Doh.  Thanks.  -Jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now