فنی

توسعه نرم افزار و فنی

How to use CLR (dotnet classes and methods) within SQL SERVER: a simple example

step 1: create a simple class like this in csharp using Microsoft.SqlServer.Server;using System.Data.SqlClient;using System;using System.Data;using System.Globalization; public class T{[SqlFunction(DataAccess = DataAccessKind.Read)]public static DateTime Jalali2Gregorian(string jalaliDate){DateTime sqlMinDate = Convert.ToDateTime(“1/1/1753”);DateTime res = sqlMinDate;try{jalaliDate = jalaliDate.Trim();int year = Convert.ToInt32(jalaliDate.Substring(6, 4));int month = Convert.ToInt32(jalaliDate.Substring(3, 2));int day = Convert.ToInt32(jalaliDate.Substring(0, 2));PersianCalendar pc = new PersianCalendar();res = pc.ToDateTime(year, month, day, 0, 0, …