Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 How to call a SQL Server UDF

Author  Topic 

Marioi
Posting Yak Master

132 Posts

Posted - 2005-12-02 : 09:30:27
A colleague is working in Visual Studio 2005 (ASP.net) and trying to run a user defined function in SQL Server 2000. Is that possible and how? He is running sProcs without problem.

TIA.

jhermiz

3564 Posts

Posted - 2005-12-02 : 09:54:26
Well a sproc can call a udf right? So why dont you call a sproc that calls a udf ????



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-12-02 : 09:59:26
A UDF is an *expression* that returns a value (or a table of values), not a an executable command or statement. You need to execute a SQL statement that calls the UDF.

i.e.,

SELECT dbo.SomeFunction() <-- for a scalar UDF

or

SELECT * from dbo.SomeFunction() <-- for a UDF that returns a table
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-03 : 02:16:34
Also
SELECT dbo.SomeFunction(col),otherCols from yourTable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Marioi
Posting Yak Master

132 Posts

Posted - 2005-12-05 : 17:10:12
quote:
Originally posted by jsmith8858

A UDF is an *expression* that returns a value (or a table of values), not a an executable command or statement. You need to execute a SQL statement that calls the UDF.


Thank you. That did it!
Go to Top of Page
   

- Advertisement -