﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server Newbies  / quotation and punctuation in sql server / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 25 May 2013 15:34:23 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: quotation and punctuation in sql server</title><link>http://www.sqlservercentral.com/Forums/Topic1378063-1292-1.aspx</link><description>r_slot,To address your original question, each single quotation mark within a string must be preceded with the single quote literal marker:[code="sql"]SELECT 'Giro d''Italia'UNIONSELECT 'This is an empty string: '''''[/code][code="plain"]output:---------------------------Giro d'ItaliaThis is an empty string: ''[/code]-gjr</description><pubDate>Thu, 01 Nov 2012 15:22:14 GMT</pubDate><dc:creator>gorthog</dc:creator></item><item><title>RE: quotation and punctuation in sql server</title><link>http://www.sqlservercentral.com/Forums/Topic1378063-1292-1.aspx</link><description>Thanks a lot guys: there is a beginning of an understanding. Putting it into practice look at the following:[code="sql"]CREATE TABLE #images (files VARCHAR(500) NULL, InsertCMDAS 'INSERT INTO Renner_Foto (ImageID, ImageName, ImageData ) '+ ' SELECT ' + LEFT(files, PATINDEX('%[^0-9]%', files) - 1) + ' AS ImageID, '+ '''' + files + ''' As ImageName, '+ 'BulkColumn FROM OPENROWSET( Bulk '+ '''D:\MijnDocumenten\DWCoureurLocaleData\Irfanview_20112011\' + files + ''','+ ' SINGLE_BLOB) AS BLOB ')[/code]The rules are:the contents of InsertCMD needs to be in single quotes;the SQL-commands need no further treatment (just single quotes);the left part don't need quotes because it is a literal;then the part with '''' + files + ''' As ImageName, ' I don't understand: files is literal but needs double quotes?the same in relation to the last part: why three quotes (double and a single I assume) before D:\MijnDocumenten\etc. then a single quote and at last again a triple and a single. The only thing that is understandable is the fact that they come in pairs, so the total amount of quotes is always even. It is the placing that give me problems.Perhaps someone can give it one further try?Thanks in advance,Robert</description><pubDate>Mon, 29 Oct 2012 02:12:46 GMT</pubDate><dc:creator>r_slot</dc:creator></item><item><title>RE: quotation and punctuation in sql server</title><link>http://www.sqlservercentral.com/Forums/Topic1378063-1292-1.aspx</link><description>This is because quotation marks in SQL are done in pairs. In order to have a single quotation mark show up in your select statement it has to be escaped. The way to do this in T-SQL is by typing two single quotes.</description><pubDate>Sun, 28 Oct 2012 17:13:06 GMT</pubDate><dc:creator>Joie Andrew</dc:creator></item><item><title>RE: quotation and punctuation in sql server</title><link>http://www.sqlservercentral.com/Forums/Topic1378063-1292-1.aspx</link><description>Here is an excellent read on the subject:[url]http://msdn.microsoft.com/en-us/library/aa259228(v=sql.80).aspx[/url]Scroll down a little more than half the page to see examples.Here is a quick example:[code="sql"]SET QUOTED_IDENTIFIER OFF    DECLARE @Toff VARCHAR(100)   SET @Toff = 'I''ve got a lovely bunch of cocnuts'   SELECT @Toff[/code]Result:I've got a lovely bunch of cocnutsedited to take result out of code block</description><pubDate>Sun, 28 Oct 2012 17:08:04 GMT</pubDate><dc:creator>bitbucket-25253</dc:creator></item><item><title>quotation and punctuation in sql server</title><link>http://www.sqlservercentral.com/Forums/Topic1378063-1292-1.aspx</link><description>Does anyone have some rules by which quotation in SQL Server works? An example:Select Year,Max(Case When Name='Tour de France'Then Coureur End) As [Tour de France]Max(Case When Name='Giro d''Italia' Then Coureur End) As [ Giro d'Italia]etc.I don't understand the punctuation in 'Giro d''Italia': it is Giro d' and Italia so one would expect Giro d' + Italia or 'Giro d'' + 'Italia', but not 'Giro d''Italia.Perhaps someone has any ideas about this phenomenon.Grz,Robert</description><pubDate>Sun, 28 Oct 2012 16:23:43 GMT</pubDate><dc:creator>r_slot</dc:creator></item></channel></rss>