title: String to row conversion SQL Server
body: <p>How can we convert the following input to a row in SQL Server?  </p>
  
  <pre><code>'e4lu50', 'e4lu10', 'e4lu11', 'e4de11', 'e4de12', 'e4nl51', 'e4es11'
  </code></pre>
  
  <p>Expected output </p>
  
  <pre><code>e4lu50
  e4lu10
  e4lu11
  e4de11
  e4de12
  e4nl51
  e4es11
  </code></pre>
  
  <p>I have a function </p>
  
  <pre><code> CREATE FUNCTION [dbo].[BreakStringIntoRows] 
       (@CommadelimitedString VARCHAR(1000))  
   RETURNS   
       @Result TABLE (Column1 INT)  
   AS  
   BEGIN  
       DECLARE @IntLocation INT  
  
       WHILE (CHARINDEX(',', @CommadelimitedString, 0) &gt; 0)  
       BEGIN  
           SET @IntLocation = CHARINDEX(',', @CommadelimitedString, 0)        
  
           INSERT INTO @Result (Column1)  
               --LTRIM and RTRIM to ensure blank spaces are removed
               SELECT 
                   RTRIM(LTRIM(SUBSTRING(@CommadelimitedString, 0, @IntLocation)))     
  
               SET @CommadelimitedString = STUFF(@CommadelimitedString, 1, @IntLocation, '')
       END  
  
       INSERT INTO @Result (Column1)  
           SELECT RTRIM(LTRIM(@CommadelimitedString))--LTRIM and RTRIM to ensure blank spaces are removed  
  
       RETURN   
   END       
  </code></pre>
  
  <p>and a query but the problem is its don't take input with a quote </p>
  
  <pre><code>WITH SEG(aa) AS
  (
      SELECT
          BreakStringIntoRows ('e4lu50', 'e4lu10', 'e4lu11', 'e4de11',
                               'e4de12', 'e4nl51', 'e4es11', 'e4it11')
  )
  SELECT * 
  FROM SEG
  </code></pre>