Showing posts with label Inline Functions. Show all posts
Showing posts with label Inline Functions. Show all posts

Wednesday, September 22, 2010

Calling Functions from Stored Procedure SQL

during my development work i stuck in a problem that sole by calling function (an inline Function) in my stored procedure .
In each procedures I used to Convert Rupees to Dollar so I make a function named Dollar converter here is the example

Create procedure My_SP(@from_Date datetime, @to_Date datetime )
As
Begin
Select carmodel,carName,CarPrice/DollarRate(Day)

End

Create Function DollarRate
(@date date)
return numeric(7,2)
(
Select ForexRate from ForexExchange where ForexRateDate = @date
)