Функция UDA, возвращающая количество продуктов подразделения
Imports System
Imports System.Data.Sql
Imports System.Data.SqlTypes
_
_
Public Class clr_product
Private m_CummTotal As Int32
Public Sub Init()
m_CummTotal = 1
End Sub
Public Sub Accumulate(ByVal value As SqlString)
If value.IsNull Then Exit Sub
m_CummTotal = m_CummTotal * CInt(value.ToSqlInt32)
End Sub
Public Sub Merge(ByVal value As clr_product)
m_CummTotal = m_CummTotal * CInt(value.m_CummTotal)
End Sub
Public Function Terminate() As SqlInt32
Return m_CummTotal
End Function
End Class