9 Mayıs 2011 Pazartesi

C# TSQL Assembly Code

using System;

using System.Data;

using System.Data.SqlClient;

using System.Data.SqlTypes;

using Microsoft.SqlServer.Server;

 

public partial class UserDefinedFunctions

{

    [Microsoft.SqlServer.Server.SqlFunction]

    public static SqlString datediff2()

    {

        // Put your code here

        return new SqlString("Hello");

    }

};

 

 

sp_configure 'clr enabled', 1

GO

RECONFIGURE

GO

ALTER DATABASE [AngelAdmin] SET TRUSTWORTHY ON

GO

 

CREATE Function datediff2() RETURNS NVARCHAR(1024)

EXTERNAL NAME TASQLHelper.UserDefinedFunctions.datediff2

 

SELECT dbo.datediff2()

Hiç yorum yok:

Yorum Gönder