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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL-DMO method to fetch UDF Collection

Author  Topic 

rajender
Starting Member

13 Posts

Posted - 2005-05-11 : 07:56:20
Hi SQL Team

I am writing a SQL-DMO wrapper class in VB 6.0, the following code will give you some idea of the class structure

Public Function Tables(ByVal oSqlServer As SQLServer2, ByVal intDatabaseIndex As Integer) As SQLDMO.Tables
Set Tables = oSqlServer.Databases.Item(intDatabaseIndex).Tables
End Function


Public Function StoredProcedures(ByVal oSqlServer As SQLServer2, ByVal intDatabaseIndex As Integer) As SQLDMO.StoredProcedures
Set StoredProcedures = oSqlServer.Databases.Item(intDatabaseIndex).StoredProcedures
End Function


This class has similar functions for all other database objects i.e for views,users etc., but i don't find method to fetch user defined functions collection the same way as i did for other objects. For example when i try to implement following code

Public Function UserDefinedFunctions(ByVal oSqlServer As SQLServer2, ByVal intDatabaseIndex As Integer) As SQLDMO.UserDefinedFunctions
oSqlServer.Databases.Item (intDatabaseIndex). 'There is no method that returns the UDF collection
End Function


Thanks in advance.
Rajender Kr.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-05-11 : 08:16:46
Funny, I found a UserDefinedFunctions collection in Books Online.
Go to Top of Page

rajender
Starting Member

13 Posts

Posted - 2005-05-11 : 08:37:27
RobVolk try this

Public Function UserDefinedFunctions(ByVal oSqlServer As SQLServer2, ByVal intDatabaseIndex As Integer) As SQLDMO.UserDefinedFunctions

Dim xDb As New SQLDMO.Database
Dim xUdf As SQLDMO.UserDefinedFunctions
Set xDb = oSqlServer.Databases.Item(intDatabaseIndex)
Set xUdf = xDb. 'At this point i don't find any method

End Function


May be i am doing something wrong.

Rajender Kr.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-05-11 : 09:51:28
I'd suggest looking in Books Online, they'll have an example in there.
Go to Top of Page
   

- Advertisement -