replace the single quote with two single quotes and eclose the entire string within quotes
Main Topics
Browse All TopicsI need to set the value of a stored procedure variable to the string below, but I'm having to contend with the problems with single quotes.
How can I do this? I've looked around and seen suggestions from others, but I've been unable to translate them to make them work.
I need everything after the "=" to be my string. Thanks.
SET @BH = 'BIHP-OT' OR 'BIHP-H' OR 'BIHP-OF' OR 'BMHP-OT' OR 'BMHP-H' OR 'BMHP-OF' OR 'BMHP-OT '
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
delimiting single quotes with single quotes does get very confusing.
I remember for a laugh writing a procedure that would generate insert statements for the contents of any given table. It had a sql string that was to be passed as a variable to a cursor that generated dynamic sql to produce a series of sql statements that had strings in them.
For char type columns I ended up with:
Business Accounts
Answer for Membership
by: aneeshattingalPosted on 2009-08-12 at 06:25:28ID: 25078453
SET @BH =' ''BIHP-OT'' OR ''BIHP-H'' OR ''BIHP-OF'' OR ''BMHP-OT'' OR ''BMHP-H'' OR ''BMHP-OF'' OR ''BMHP-OT '''