is there a method/t-sql script to automate 'tasks->generate scripts' that we do from Object explorer in SSMS 2005?(note: i'm not having/using VB, .NET, scptxfr.exe etc)i used SQLDMO, but it doesn't script 'grant view definition' permissionsdeclare @oServer intexec sp_OACreate 'SQLDMO.SQLServer', @oServer OUTexec sp_OASetProperty @oServer, 'loginsecure', 'true'exec sp_OAMethod @oServer, 'Connect', NULL, 'Abc' -- ('Abc' is server name)exec sp_oamethod @oServer, 'Databases("pubs").storedprocedures("spNames").Script(103,"\\vss\dbo.spNames.storedprocedure.sql")'exec sp_OADestroy @oServer
- '103' above is the options for drop/create/permissions/file ( http://msdn.microsoft.com/en-us/library/ms135191.aspx )- got this script from http://www.dbazine.com/sql/sql-articles/larsen4but if 'spNames' has these permissions'exec to asdf' &'grant view definition to asdf'it only scripts 'grant exec on spNames to asdf', not 'grant view ...' - why?