Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to update a column where I am giving query which is

Update Table 
Set col = '[189] IS NOT NULL and [189] <> ''' 
Where colid= 198

But it's giving output:- [189] IS NOT NULL and [189] <> '

I want output :- [189] IS NOT NULL and [189] <> ''

I am not getting single quotes at last. Please let me know how to give update query? Thanks in advance.

share|improve this question

For each single quote you want in a string constant, you need to use two to represent it

Two quotes in the string requires you to use 4 like this:

Update Table Set col = '[189] IS NOT NULL and [189] <> ''''' Where colid= 198
share|improve this answer
Thanks gbn for your quick reply....It works exactly as I wanted.. Thank you very much..... – ramu May 16 '13 at 11:21
@ramu if this solves your issue please consider accepting the answer by clicking the check mark on the left of the answer. – JNK May 16 '13 at 12:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.