By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

call user defined sql function via classic asp

100+
P: 120
hi guys

I have a user defined sql function in my sql server db called TenPercentDiscount but not sure how to call it via classic asp?

iv tried both
objRS(TenPercentDiscount("Double_Redleaf_Price"))
TenPercentDiscount(objRS("Double_Redleaf_Price"))

but not having any joy? Double_Redleaf_Price is an integer value and my function code is
Expand|Select|Wrap|Line Numbers
  1. CREATE FUNCTION TenPercentDiscount 
  2. (@InputVals int)
  3. RETURNS int
  4. AS
  5. BEGIN
  6. declare @convertedVal varchar(30)
  7. set @convertedVal =  Cast(@InputVals  * 0.9 as int)
  8. return  @convertedVal 
  9. end
please adivse
omar
Nov 11 '10 #1

✓ answered by jhardman

You can't call it from the asp, you need to use it IN your sql query.
Expand|Select|Wrap|Line Numbers
  1. select tenpercentdiscount(redleafprice) as newprice from mytable 
Jared

Share this Question
Share on Google+
2 Replies


jhardman
Expert 2.5K+
P: 3,405
You can't call it from the asp, you need to use it IN your sql query.
Expand|Select|Wrap|Line Numbers
  1. select tenpercentdiscount(redleafprice) as newprice from mytable 
Jared
Nov 11 '10 #2

100+
P: 120
hi Jared - thanks for clarifying.

I shall post this question in the sql section then..

thanks again
Omar.
Nov 11 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.