|
-
Apr 2nd, 2003, 09:51 AM
#1
Thread Starter
Fanatic Member
Executing SQL FUNCTION
If i wrote my function on a SQL SERVER (on User Defined Functions on the Database). How can i call from My VB project and how could i pass parameters?
-
Apr 2nd, 2003, 09:56 AM
#2
Fanatic Member
function as stored procedure?
-
Apr 2nd, 2003, 10:06 AM
#3
Thread Starter
Fanatic Member
-
Apr 2nd, 2003, 10:07 AM
#4
Thread Starter
Fanatic Member
Sorry. Not store procedure as function. A user defined function, saved on this folder on the database.
-
Apr 2nd, 2003, 10:07 AM
#5
I don't think ADO can call functions directly... (but I could be wrong)... but you could use a stored procedure as a "wrapper" to calling the function.
So, it would work like this app (using ADO) calls the stored procedure, which calls the function.... parameters would be passed to the stored proc which would pass them to the function, and the result would then get passed back through an output parameter...
-
Apr 2nd, 2003, 10:10 AM
#6
Fanatic Member
I've never heard of such a thing. Which doesn't really mean anything. Good luck.
-
Apr 2nd, 2003, 10:16 AM
#7
Originally posted by Briantcva
I've never heard of such a thing. Which doesn't really mean anything. Good luck.
Starting w/ SQL2000, you can create Functions which can return a sincgle value (scalar) or a table (table function).... these are neat in that they can be used as part of a larger SQL statement, the way you can include a view, but they are better than a view because you can pass parameters to them, like a stored proc.
Normally you can't join to a stored proc or use the return value of a stored proc as a field in a select, so MS created UDFs, USer Defined Functions..... we've found then quite handy and wonderfull.
-
Apr 2nd, 2003, 10:20 AM
#8
Fanatic Member
And now I feel better and not having heard of them (running NT and SQL 7). Very cool. Thanks.
-
Apr 2nd, 2003, 11:53 AM
#9
Thread Starter
Fanatic Member
RESOLVED
sqlstring = "Select top 1 suscripcion.dbo.ultimo_dia_del_mes(" & CVar(fecha) & ") from parametros "
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open sqlstring, cn, adOpenForwardOnly, adLockReadOnly
x = rs.Fields(0)
Where
suscripcion.dbo=Database
ultimo_dia_del_mes=Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|