• I think if you install a copy of SQL Server Data Tools on top of either VS 2010 or VS 2012 you now get the SQLCLR project types for free and you can target any version of SQL Server from the SQLCLR project type.

    This is the source code for the UDF on the other thread I would recommend you start with:

    [font="Courier New"]using System;

    using System.Data;

    using System.Data.SqlClient;

    using System.Data.SqlTypes;

    using Microsoft.SqlServer.Server;

    using System.Collections;

    using System.Net.Mail;

    public partial class UserDefinedFunctions

    {

        [Microsoft.SqlServer.Server.SqlFunction]

        public static SqlBoolean IsValidEmailSystemNet(SqlString email)

        {

            try

            {

                System.Net.Mail.MailAddress ma = new System.Net.Mail.MailAddress(email.ToString());

                return (SqlBoolean)true;

            }

            catch

            {

                return (SqlBoolean)false;

            }

        }

        [SqlFunction(FillRowMethodName = "EmailIsValidSystemNet",

            TableDefinition = "EmailIsValid bit")]

        public static IEnumerable EmailValiditySystemNet(SqlString emailAddress)

        {

            ArrayList EmailCollection = new ArrayList();

            EmailCollection.Add(emailAddress);

            return EmailCollection;

        }

        //FillRow method. The method name has been specified above as

        //a SqlFunction attribute property

        public static void EmailIsValidSystemNet(object emailAddress,

                                        out SqlBoolean emailIsValid)

        {

            try

            {

                MailAddress ma = new MailAddress(emailAddress.ToString());

                emailIsValid = (SqlBoolean)true;

            }

            catch

            {

                emailIsValid = (SqlBoolean)false;

            }

        }

    };

    [/font]

    And here is how you would call it:

    SELECT t.EmailAddress,

    x.EmailIsValid

    FROM SomeTable t

    CROSS APPLY dbo.EmailValiditySystemNet(t.EmailAddress) x;

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato