using my own 'functions' within sql statements 
Author Message
 using my own 'functions' within sql statements


        the best way of asking this question is to just to describe it
with an example.  say you have a query that looks like this

select intfield1, intfield2, charfield1, charfield2
from foo

what i would like to be able to do is write my own functions that i can
use just like built in functions

for instance, say there is a built-in function called 'upper' that
'returns' the characters you pass it as upper case.  one could use this
function as follows

select intfield1, intfield2, upper (charfield1), upper (charfield2)
from foo

i would like to have a funtion called stringRepear that takes has the
following prototype (this is psuedo code - i realize i'm being somewhat
'loose' with syntax).

String strRepeat (int n, String str)
        String result ;

        for (int i = 0 ; i < n ; i++)
                result += str ;


assuming i could integrate this function into sql server, i could then
write the following query

select strRepeat (intfield1,charfield1), strRepeat (intfield1,charfield1)
from foo

so, i have two questions
1) is it possible to extend sql server by adding functions to it
2) if it is possible, how does one do it.  

i should note that these functions need to be as fast as possible.


Mon, 18 Sep 2000 03:00:00 GMT
 [ 1 post ] 

 Relevant Pages 

1. using my own 'functions' within sql statements

2. Using 'like' in sql statement

3. SQL statement using 'IN' clause

4. Get sp's own name within the SP

5. Using a Function within an SQL-Statement

6. SQL: include "'" within the statement

7. IF- statements in a rule's 'DO INSTEAD SELECT ...'- statement

8. IF- statements in a rule's 'DO INSTEAD SELECT ...'- statement

9. how to call any of VFP's own API functions from VFP (not C/C++)

10. my own functions within sql command

11. Using the EXCEL function 'Choose'

12. Using String Parameter for 'IN' Statement

Powered by phpBB® Forum Software