Question

I am trying to insert the following text into a table cell, which is varchar(8000).

SELECT DISTINCT TOP 100 * 
FROM  
    (SELECT TOP 10000 * 
     FROM 
        (SELECT DISTINCT 
             rklient, nimi + ISNULL('(' + UPPER(oleknimi) + ')' ,'') AS nimi,
             mkood, kommentaar, regkood,
             ISNULL(aadress + ' ','') AS aadress, 
             naitatel AS telefon, NULL AS lepingutelefon, 
             faks, email, www, NULL AS sisu, iprowid, 
             varvikood, klient, saitrank AS rank, emaid, 'F' AS typ, 
             infobaas, x, y, ISNULL(lahtiolekuaeg,'none') as lahtiolekuaeg, 
             lahtikomment, NULL AS koiksynid, paigutus, nimeviide, kupong  
         FROM 
             table_name WHERE reanr = '10') Tulemus) e 
WHERE 
    nimeviide IS NULL  
ORDER BY 
    rank DESC, iprowid

It gives me incorrect syntax. I suppose its because this: '

How do I workaround this?

Pas de solution correcte

Autres conseils

You can quote the ' character by simply doubling it ''.

Example:

   SELECT 'This is q single quote ''';
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top