I have a user defined sql function in my sql server db called TenPercentDiscount but not sure how to call it within sql statement?
I'm ideally looking for my function to be applied to a select * sql statement similar to my amateur attempt below
iv tried both
"SELECT * FROM TenPercentDiscount(RMT_2DayTours) WHERE ID IN (1,2,3)"
"SELECT TenPercentDiscount, * FROM RMT_2DayTours WHERE ID IN (1,2,3)"
but not having any joy? my function code is
Expand|Select|Wrap|Line Numbers
- CREATE FUNCTION TenPercentDiscount
- (@InputVals int)
- RETURNS int
- AS
- BEGIN
- declare @convertedVal varchar(30)
- set @convertedVal = Cast(@InputVals * 0.9 as int)
- return @convertedVal
- end
omar