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

Calling a UserDefined Function

P: 31
Does anyone know how to call a UserDefined Function written in SQL 2000 from program(I mean I am writing code in know how to call it from a stored proc. but don't know how to call from my prog. Like we call stored proc.
Apr 23 '09 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,134
I haven't actually tried it with a UDF but I know you can call a stored proc from vbscript like this.

Expand|Select|Wrap|Line Numbers
  1. str="exec YourProc Param1,Param2"
  2. objSQLServerConection,str
Which is the standard way of executing an SP in SQL syntax.

so I suspect you might be able to call the UDF just like you would in any SQL server syntax method of calling a UDF

Expand|Select|Wrap|Line Numbers
  1. str="SELECT dbo.YourUDF(par1,par2)"
  2. objSQLServerConection,str
well, something like that .
And you will, of course, need to observe syntax
Apr 24 '09 #2

Expert 2.5K+
P: 2,878
If it's a scalar function, try re-creating it in your front-end. If it's a multi-lined, run it as ordinary T-SQL and monitor your result set. If it's a table-function, access it as if you're accessing a table or a view.

--- CK
Apr 24 '09 #3

Post your reply

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