Advertisement
Guest User

Exchange Rate Function

a guest
Aug 17th, 2017
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.72 KB | None | 0 0
  1. USE [LL_GPPS_2017]
  2. GO
  3. /****** Object:  UserDefinedFunction [dbo].[udfGetExchangeRate]    Script Date: 17/8/2017 9:57:22 AM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. -- =============================================
  9. -- Author:      Vitu Mhone <mhone.vitu@gmail.com>
  10. -- Create date: 16th August 2017 10:18 am
  11. -- Description: Function to get an exchange rate
  12. --              for a sale date
  13. -- =============================================
  14. ALTER FUNCTION [dbo].[udfGetExchangeRate]
  15. (
  16.     @SaleDate date
  17. )
  18. RETURNS decimal(8,4)
  19. AS
  20. BEGIN
  21.     DECLARE @SaleExchangeRate decimal(8,4)
  22.     SELECT @SaleExchangeRate = SALE_EXCHANGE_RATE FROM [AHL_LL_2017].[dbo].[tbl_Sales] WHERE [SALE_DATE] = @SaleDate
  23.     RETURN @SaleExchangeRate
  24. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement