Once you are connected to SQL Server 2005 with a SMO connection, you can start manage and create object. Here is an example on how you can create a stored procedure, we imagine that we have the code of a stored procedure in an embeded resources file. (this sample is written in C# and use a beta version of SQL Server 2005 and of the .Net Framework 2.0).
For this sample you need to use the following name space :
using
And here is the code of the sample :
StoredProcedure
mySP =
myResourceFile =
mySP.TextBody = sr.ReadToEnd();
mySP.Create();