473,668 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

call user defined sql function via classic asp

120 New Member
hi guys

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

iv tried both
objRS(TenPercen tDiscount("Doub le_Redleaf_Pric e"))
TenPercentDisco unt(objRS("Doub le_Redleaf_Pric e"))

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
2 6391
jhardman
3,406 Recognized Expert Specialist
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
omar999
120 New Member
hi Jared - thanks for clarifying.

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

thanks again
Omar.
Nov 11 '10 #3

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

Similar topics

1
11565
by: Joel Thornton | last post by:
Is it possible to call a user-defined function without prefixing it with 'dbo.' within a SELECT clause somehow? Just curious; it's not a big issue but just a stylistic one for me. Thanks! Joel Thornton ~ <groups@joelpt.eml.cc>
2
2559
by: Steve D | last post by:
I've looked all over but can't find a solid answer. I've got a function that runs from a View and when the function runs the first time it is calculating a Temperature for a group of Formulas. What I want to do is calculate this temperature in the UDF on the first pass and store it somewhere (table, global variable etc.). On every execution after that I'd like to use the value stored so I don't have to recalculate the value again for...
2
11905
by: Highlander416 | last post by:
This is driving me crazy. I need to create a UDF that would return a TRUE/FALSE (bit) value based on a comparison it does. CREATE FUNCTION dbo.SelectedByApplication ( @ApplicationID int, @TableToCheck nvarchar(50), @ColumnToCompare nvarchar(50),
13
3485
by: Maroon | last post by:
Hi, I want to write a standard java user defined function, like this example:- select db_fun("roll"), roll from student; **db_fun() will work for all tables of the all databse here db_fun is the function that i want to write. The student table is:- roll name 1 'A'
1
2090
by: David Carwile | last post by:
I want to add a user defined function inside of an SQL string. I am using the function to change a group of numbers in a string to a specific format that can be sorted by Access(utilizing 0s). Function is called Zero pad and is from an old Access 97 magazine. My question is how do I put the function with the SQL. I have written the string correctly to include the function much like a Val() or CDate(). How do I make the function known...
1
2556
by: Mphoza | last post by:
Hi! Programmers,,,,,, Scenario I have a DataGrid with the delete button, If the user delete the row I'd like to show a confirmation dialog box with two buttons(Yes,No). If the user click yes the program must call my user-defined function to delete the row from database. The problem is I do not know how to create a confirm on deletes in a datagrid.
3
4123
by: chreo | last post by:
I have user-defined function in MSSQL which returns Table (with 10 columns) (sorry for Polish names) CREATE FUNCTION PACZKI_Z_AKCJI (@AKCJA_ID int) RETURNS TABLE RETURN SELECT TOP 100 PERCENT dbo.PACZKI.ID_PACZKI, dbo.PACZKI.ID_AKCJI, dbo.PACZKI.NR_PACZKI, dbo.PACZKI.ILOSC_KUPONOW, LOG_1.Login AS LOGIN1,
2
10495
by: Lalit Bhatia | last post by:
How can we call a sql server user defined function from C#? -- Regards, Lalit Bhatia
2
2624
by: Mark B | last post by:
I have been able to retrieve the scalar value of a SQL Server Stored Procedure as follows: Shared Function fGetGroupPerformanceStatistic(ByVal strGroup As String) As String Dim sqlConnection1 As New SqlConnection("Data Source=MARK\SQLEXPRESS;Initial Catalog=GroupSales;Integrated Security=True;") Dim cmd As New SqlCommand
1
5935
by: qwedster | last post by:
Hola! In the following code snippet, I am creating User Defined Function (T-SQL) programmatically into database from C# Code: BTW, this code originally I wrote for creating StoredProcedure programmatically, which worked fine. Now, I am trying to create User Defined Function programmatically (by just replacing "StoredProcedure" class with "UserDefinedFunction" class). The User Defined Function checks if "FirstName" exists in "Customer"...
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8371
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8889
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8652
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.