title: CLR Assembly C# inside SQL Server
body: <ul>
  <li>Is it possible to make a big project in C# (lots of functions), then,</li>
  <li>Create CLR Assembly for it, then, </li>
  <li>In SQL Server IN A STORED PROC, call a function that is in the assembly,</li>
  <li><p>The table (which I would pass to ASSEMBLY) is computed in other stored proc...</p>
  
  <ul>
  <li>If so, What would be the steps?</li>
  </ul></li>
  </ul>
  
  <p>I am thinking something like this.</p>
  
  <pre><code>-- I have a stored proc that gets a table, let it be myStoredProcTable
  
  --FIST ENABLE DATA ACCESS
  EXEC sp_serveroption 'TheServerName', 'DATA ACCESS', TRUE
  
  --main.sql calls yStoredProcTable.sql and the calls functionAssembly
  SELECT  *
  INTO    #tmpTable
  FROM    OPENQUERY(SERVERNAME, 'EXEC test.dbo.myStoredProcTable 1')
  
  
  -- pass the table to assembly
  -- how would i pass the table to assembly code?, Is this POSSIBLE?
      EXEC functionAssembly #tmpTable
  </code></pre>
  
  <p><strong>------------------------------------------edit</strong></p>
  
  <p>Following <code>@faester</code> answer:
   - How could I use XML in the code, I suggested to use the <code>numberTOstring</code>  thing, but I guess <code>XML</code> option is the best here...</p>
  
  <p>Again, I really do this, even if is not the best choice...</p>