Hi,
Is it possible to run a script using Microsoft.SqlServer.Management.Smo?
I am able to generate script using the Microsoft.SqlServer.Management.Smo.Scripter class. I would like to edit it and run it to create copy of database objects.
Thanks.
Hi,
Is it possible to run a script using Microsoft.SqlServer.Management.Smo?
I am able to generate script using the Microsoft.SqlServer.Management.Smo.Scripter class. I would like to edit it and run it to create copy of database objects.
Thanks.
You can try this. The other option is to use the SQLCommand object.
string script = "create procedure b as select getdate()";
Database db = new Database(new Server("ServerName"), "DBName");
db.ExecuteNonQuery(script);