Solved

Function to remove apostrophes ( ' ) from a string

Posted on 2007-12-03
2
1,549 Views
Last Modified: 2008-02-01
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
Comment
Question by:Jim Horn
2 Comments
 
LVL 7

Accepted Solution

by:
wittyslogan earned 500 total points
ID: 20397665
replace(PERS_LAST_NAME,'''','')

should do it.  
0
 
LVL 65

Author Comment

by:Jim Horn
ID: 20398067
Doh.  Thanks.  -Jim
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now