sqlclr

writing t-sql version of .net codes by using sqlclr

hi, i have a lot of methods wrote with.net codes (c#) to using with linq queries. but i have problem to translating methods to t-sql. and i want to convert that to t-sql functions and using that with t-sql queries directly. how? ...

SQLCLR & IronPython

Hi, Im feeling crazy and I've decided I would really like to write a User-Defined Function in Python that would run in SQL Server 2008. I am interested in doing this as I have a few thousand lines of PL/Python functions written for PostgreSQL and I am interested to know if I can get the project running on SQL Server instead. I am looki...

CLR SQL Server 2005 procedure to take stored procedure results as a parameter

I have a stored procedure that returns a rowset that I'd like to pass into a CLR stored procedure to do some advanced calculations. How would I set this up? Take the input? Iterate the rowset within the CLR procedure? ...

SQL Server 2008 and COM server programming

Hi, We need to access a custom ATL COM server from SQL server 2008. Ideally we want the COM server to live on a separate machine since it is part of a larger software application. I know of the COM/OLE automation stored procedures that SQL provides (sp_OAXXXX) but they don't seem to accept a computer/server name for remote invocation. ...

Pre/Post deployment scripts in VS2010

We are migrating from VS2008 to Vs2010. Currently we have a VS 2008 SQL CLR project that uses predeployscript.sql and postdeployscript.sql files to run pre and post deploy scripts. Once the project was converted to VS2010 and I try to deploy it against a database, I get errors indicative of the fact that the predeploy script was not run....

Migrating SQL CLR project from VS2008 to VS2010 - deploy fails

I have a solution with a SQL CLR project in VS2008. The solution / project was converted to VS2010 and now the deploy no longer works. I get the following type of erros: Beginning deployment of assembly MyProjectDatabaseCode.dll to server DEVPN-004 : MyProject The following error might appear if you deploy a SQL CLR project that ...

What is a good approach in MS SQL Server 2008 to join on a "best" match?

In essence I want to pick the best match of a prefix from the "Rate" table based on the TelephoneNumber field in the "Call" table. Given the example data below, '0123456789' would best match the prefix '012' whilst '0100000000' would best match the prefix '01'. I've included some DML with some more examples of correct matches in the SQL...

How can I get the 'External name' of a SQL CLR trigger?

I have created a SQL CLR trigger with the follow SQL: GO CREATE TRIGGER AuditAccountsTable ON [dbo].[Accounts] FOR INSERT,DELETE,UPDATE AS EXTERNAL NAME namespace.Triggers.AuditTrigger I am trying to query: select * from sys.triggers Is there a way to find the: EXTERNAL NAME namespace.Triggers.AuditTrigger on the trigger fro...

VS2010 - SQL CRL Deploy error - Deploy error SQL04105: The model already has an element that has the same name

I have a SQL CLR project created in VS2010. It needs to run PreDeployScript.sql and PostDeployScript.sql. Both files exist in project. However, when trying to run the deploy, I get the following error messages: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlClr.targets(96,5): Deploy erro...

Moving C# in Process Functions to SQL Server CLR functions

What are the limitations, unexpected pitfalls and performance traits of moving from in process C# code to SQL CLR Functions? We currently have several data heavy processes that run very fast using in process C# Asp.net MVC project without using a db at all. Performance is very important. The application uses a static in memory cache ...

Computed columns in SQLCLR project in Visual Studio 2010

It appears that MS has a bug when dealing with VS 2010 SQL CLR project and computed columns. I am using Pre/PostDeployScript.sql to drop/add the computed column. However, if I try to deploy from VS2010 it, I get dependency errors. The same project works 100% in Vs2008. I am wondering what my options are in terms of deploying to work arou...

SQLCLR trigger vs Windows service. When is it appropriate to use SQLCLR?

We have a .NET e-commerce application with a SQL Server 2005 back-end. A new order requires certain "post-processing". These tasks include sending emails, creating files, uploading files to an FTP server, and performing CRUD operations against a WCF data service. The code to perform all these tasks is already in place as several .NET cla...

How to detect SQL Hosted CLR at runtime

I would like to detect that my assembly is loaded in SQL Hosted CLR at runtime in order to safely process the AppDomain FriendlyName string. Unfortunately, AppDomain.CurrentDomain.DomainManager.EntryAssembly is null in this context. Any help appreciated. TIA. ...

SQL CLR DDL trigger written on C#

Is it possible to create a database/DDL trigger in C#? And, if so, then how? [EDIT] Basically, I decided to use CLR for the database trigger because I want to utilize C# SMO to script the objects that change and insert the object script into a table that tracks versions of database objects. ...

How to call C# function in stored procedure

SQL Server 2005 supports CLR so it means we can use CLR in backend so how to do that, I have some function in c# which do some complex manipulation with date-time variable now I want to use those functions in SP. First of all IS IT POSSIBLE TO DO THIS. ...

Can I use Razor (or similar) in a regular .NET class, i.e. get string interpolation of sorts?

I could've sworn I saw some articles a while ago about imperfect but useful string interpolation methods for C, but no such luck right now. However, there's Razor, which does more or less what I want. Suppose you have a database client application with tickets, and e-mail notifications are to be sent whenever tickets get created, signif...