Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Partial Public Class UserDefinedFunctions
Public Const SALES_TAX As Double = 0.086
<SqlFunction()> _
Public Shared Function addTax(ByVal originalAmount As SqlDouble) As SqlDouble
Dim taxAmount As SqlDouble = originalAmount * SALES_TAX
Return originalAmount + taxAmount
End Function
End Class
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class UserDefinedFunctions
{
public const double SALES_TAX = .086;
[SqlFunction()]
public static SqlDouble addTax(SqlDouble originalAmount)
{
SqlDouble taxAmount = originalAmount * SALES_TAX;
return originalAmount + taxAmount;
}
}
#include "stdafx.h"
#using <System.dll>
#using <System.Data.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Data;
using namespace System::Data::Sql;
using namespace System::Data::SqlTypes;
using namespace Microsoft::SqlServer::Server;
// In order to debug your Aggregate, add the following to your debug.sql file:
//
// SELECT dbo.addTax(10)
//
public ref class UserDefinedFunctions
{
public:
static initonly double SALES_TAX = 0.086;
[SqlFunction()]
static SqlDouble AddTax(SqlDouble originalAmount)
{
SqlDouble taxAmount = originalAmount * SALES_TAX;
return originalAmount + taxAmount;
}
};