Calling a UserDefined Function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SnehaAgrawal
    New Member
    • Apr 2009
    • 31

    Calling a UserDefined Function

    Does anyone know how to call a UserDefined Function written in SQL 2000 from program(I mean I am writing code in VB.net)..I know how to call it from a stored proc. but don't know how to call from my prog. Like we call stored proc.
    Thnks
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    I haven't actually tried it with a UDF but I know you can call a stored proc from vbscript like this.

    [code=vb]
    str="exec YourProc Param1,Param2"
    objRecordset.op en objSQLServerCon ection,str
    [/code]
    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

    [code=vb]
    str="SELECT dbo.YourUDF(par 1,par2)"
    objRecordset.op en objSQLServerCon ection,str
    [/code]

    well, something like that .
    And you will, of course, need to observe vb.net syntax

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      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

      Comment

      Working...