Why SQL server does not accept '' (single quote) as an entry

  •  

    Can somebody teach me how to configure the SQL server , so it will allow to accept a single quote in my string variable.

    I declare the datatype as nvarchar.

     

     

  • If you have to have the single quote stored in the database then you need to put it in twice.

    EG: don't becomes don''t

    You could also play around with SET QUOTED_IDENTIFIER, but I've generally found that to be more trouble than it's worth. Take a look at the topic in Books Online, there are a couple of relevant examples there.

     

    --------------------
    Colt 45 - the original point and click interface

  • Did somebody know where to put SET QUOTED_OFF in MS SQL server . Put in asp.net code or in MS SQL query

  • As suggested, don't use that. Why aren't you using stored procs to do this work? It would avoid the problem altogether.

  • Let's add this to the ever-growing list of "Reasons why dynamic SQL is evil"

  • Sure .

    The Curse and Blessings of Dynamic SQL

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply