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

Author  Topic 

HenrydeSousa
Starting Member

1 Post

Posted - 2008-01-24 : 06:22:26
Hi everybody.

I have two questions on SQL-DMO.

The first one: how can i retrieve the script for all the stored procedures in a
particular database?

This is the code i used to do this but i would like to know wheter there is another way and
a better way.


Dim oSqlServer As New SQLServer
oSqlServer.LoginSecure = True
oSqlServer.Connect("(local)", "", "")

Dim oDataBase As Database
oDataBase = oSqlServer.Databases.Item("northwind")

Dim oSP As StoredProcedure
For Each oSP In oDataBase.StoredProcedures
txt_script.Text = txt_script.Text + oSP.Script()
Next

The second question is how can i put that script back to the database? i mean how can i compile
that script again?


Note: i am using vb.net

Thanks in advance

Henry de Sousa
   

- Advertisement -