Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
koese
Starting Member
1 Post |
Posted - 2011-05-30 : 00:17:31
|
Hi I have created the below UDF from SQl CLR database Project from Visiual Studio 2010 and after diploying the UDF it works fine on the sql test Server
Since my SQl Production server is a shared hosting server it does not support the .Net Framerwork CLR, It is disabled on the sql 2008 database
Can some one help me to convert this function into a SQL standalone UDF
Public Shared Function ChecksumMTS(ByVal MerchantxnStem As String) As String Const ReplaceChars As String = ("abcdef") Const ReplaceWith As String = ("JKLMPR") Dim sha_1 As New SHA1CryptoServiceProvider() Dim i As Long Dim a As Byte() = Encoding.UTF8.GetBytes(MerchantxnStem) Dim t As String = Convert.ToBase64String(sha_1.ComputeHash(a)) t = Mid(t, 2, 2) i = InStr(ReplaceChars, (Left(t, 1))) If i Then Mid(t, 1, 1) = Mid(ReplaceWith, i, 1) End If i = InStr(ReplaceChars, (Right(t, 1))) If i Then Mid(t, 2, 1) = Mid(ReplaceWith, i, 1) End If ChecksumMTS = t End Function
Thanks |
|
|
|
|