title: A ton of single quotes in an SQL statement?
body: <p>I'm really struggling to make sense of an SQL query they are using at the job where I was just hired. The person who originally wrote it is no longer here so I can't ask for an explanation.</p>
  <pre><code>SET @Openquery=''SELECT * FROM OPENQUERY(IFOPENEDGEDB,''''''
      SET @TSQL=''SELECT  orderno, ordersuf, cono, whse, transtype, ordertype, enterdt, custno, shipto, lineno,
          qtyord, shipprod, reqprod, proddesc, unit, price, stkqtyship, prodcost, prodcat, arpvendno,
          orderaltno, netamt, icspecrecno, statustype, glcost, vendno, pdrecno, commcost, discpct,
          qtyship, taxablefl, linealtno, promofl, disccd, pricetype, qtyrel, netord, stkqtyord,
          slsrepin, slsrepout, commtype, invoicedt, returnfl, returnty, qtyreturn, transproc, canceldt,
          priceorigcd, priceoverfl, prodline, transdt, transtm, taxamount, pricecostty, operinit,
          corechgty, corecharge, botype, bono, specnstype, reqshipdt, prevqtyshp, transdttmz, xrefprodty
      FROM    PUB.oeel
      WHERE transdttmz &gt;= '''''''''' + CONVERT(VARCHAR(50), @LastUpdatedUtc) + '''''''''''''')'';
  </code></pre>
  <p>I don't understand why the first line doesn't have a semicolon to terminate the SET command. I do not understand why multiple single quotes appear so often. What the hell does '''''''''''' mean? What could that do? Any help would be appreciated. This query is to bring information over from an OpenEdge database they are using for their ERP system. Thanks for your help.</p>