<p>What are some important practices to follow when creating a .NET assembly that is going to be embedded to SQL Server 2005?</p>

<p>I am brand new to this, and I've found that there are significant method attributes like:</p>

<pre><code>[SqlFunction(FillRowMethodName = "FillRow", TableDefinition = "letter nchar(1)")]
</code></pre>

<p>I'm also looking for common pitfalls to avoid, etc.</p>

[{'answer_id': 72113, 'author': 'chakrit', 'author_id': 3055, 'author_profile': 'https://Stackoverflow.com/users/3055', 'pm_score': 3, 'selected': True, 'text': "<p>Some that I remember:</p>\n\n<ul>\n<li>Keep its usage to a minimum, only use it when T-SQL proved too complex.</li>\n<li>Avoid pointers/cursors at all costs because a for loop is so easily abusable in CLR context.</li>\n<li>Only use the SQL-Server native data types unless totally necessary.</li>\n</ul>\n\n<p>Can't remember where I've found the information, but those are some that I do remember.</p>\n\n<p>Basically, only use it when declarative T-SQL is too complex or is impossible to do (such as registry editing etc.).</p>\n"}, {'answer_id': 72247, 'author': 'icelava', 'author_id': 2663, 'author_profile': 'https://Stackoverflow.com/users/2663', 'pm_score': 1, 'selected': False, 'text': '<p>Single tip regarding assembly deployment:</p>\n\n<p>Keep functionality isolated across small assemblies. Try not to build a dependency chain, because replacing a base assembly means you need to remove the dependent assemblies <em>first</em>, before you can update the base assembly.</p>\n'}, {'answer_id': 72941, 'author': 'David Waters', 'author_id': 12148, 'author_profile': 'https://Stackoverflow.com/users/12148', 'pm_score': -1, 'selected': False, 'text': '<p>I would strongly advise against putting .net assemblies in your database server, think n-tier applications. Persistence &lt;- Business Logic &lt;-Presentation Logic &lt;- client\nKeep your Logic in your Business Logic layer. </p>\n\n<p>The only reason I can think of to put .net in your database would to add a new complex data type, I would strongly that this be a dumb class that only holds data and does no processing on it.</p>\n\n<p>Just because you can does not mean you should. \nSorry for not directly answering your question.</p>\n'}]
['https://Stackoverflow.com/questions/72014', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11947/']