SQL Server Function To Return Amount As Decimal
Here's a simple function that will return the freight amount in decimal format.
Cheers!
use Your_Database_Name if object_id (N'dbo.getFreightValue', N'FN') is not null drop function getFreightValue go create function getFreightValue ( @salesID nvarchar(50) ) returns decimal(10,2) as begin declare @result varchar(50) set @result = ( select Freight from dbo.Orders where OrderID = @salesID ) return @result end go -- run function -- select dbo.getSomeValue(10248) as freight_value;
Comments
Post a Comment