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
 Old Forums
 CLOSED - General SQL Server
 UDFs

Author  Topic 

ang
Starting Member

2 Posts

Posted - 2007-01-15 : 08:42:07
Help i need somebody.

I am trying to loop through & set execute permission on some UDFS but I cannot find an option for UDF's.

Private mobjSQL As SQLDMO.SQLServer
Dim objDB As SQLDMO.Database


Private Sub GrantUDF()

Dim objDB As SQLDMO.Database
Dim objUDFS As UserDefinedFunctions
Dim objUDF As SQLDMO.UserDefinedFunction
Dim lngUDFCount As Long
Dim lngProg As Long

For Each objDB In mobjSQL.Databases
If ListItemChecked(Me.lstDatabases, objDB.Name) Then
lngUDFCount = objDB.????????????????????
lngProg = 0
For Each objUDF In objDB.??????????????????
GeneralProgress objUDF.Name, 0, lngUDFCount, lngProg
objUDF.Grant SQLDMOPriv_Execute, "AGDB"
lngProg = lngProg + 1
Next
GeneralProgress "Finished", 0, lngUDFCount, lngProg
End If
Next

End Sub

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-15 : 08:51:08
Instead of
Dim objDB As SQLDMO.Database


Try this:
Dim objDB As SQLDMO.Database2


You should see UserDefinedFunctions collection.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -