I have one project inside that I have SqlServerFunctions
in test.cs file. code:
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlDecimal CalculateBondDV0N(SqlDecimal coupon, SqlDecimal yield, SqlDateTime date)
{
DayCount dayCount = (DayCount)Enum.Parse(typeof(DayCount), dayCountString.ToString(), true);
Frequency frequency = (Frequency)Enum.Parse(typeof(Frequency), frequencyString.ToString(), true);
double price = BondAnalyticsUtility.CalculateDV0N((double)coupon.Value, dayCount, frequency, (double)yield.Value, date.Value, finalPaymentDate.Value, (double)redemptionValue.Value, (double)notional.Value, (double)spreadChange.Value);
SqlDecimal returnVal = new SqlDecimal(price);
return returnVal;
}
And this function get called from Sql Server inside Scalar valued function by giving EXTERNAL
parameter.
ALTER FUNCTION [dbo].[CalculateBondDV0N](@Coupon [decimal](18, 6), @Yield [decimal](18, 6), @Date [datetime])
RETURNS [decimal](18, 7) WITH EXECUTE AS CALLER
AS
EXTERNAL NAME [Pearl.Analytics.Services.Database].[BondAnalytics].[CalculateBondDV0N]
I want to debug this function the code is in c# trying to debug in into VS2010 pro how can i attached it with database and do this.?
If you don't need to debug it within SQL Server, then it's quite easy to just call it naturally from normal C# code. Seeing as your method only makes use of very basic types, I can't see any reason to need to debug it within SQL Server.
I am not sure where 'dayCountString' and 'frequencyString' come from, however. I have a suspicion that those should be parameters to the function too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.