I am trying to force SMO to schema qualify object names for stored procedures, UDFs and views, but for some reason it doesn't work. I have got a stored procedure without a schema and need to have the default schema pre-pended to it:
I have this code:
var procs = from sp in _smoDB.StoredProcedures.OfType<StoredProcedure>()
where !sp.IsSystemObject && !sp.IsEncrypted
select sp;
foreach ( StoredProcedure sproc in procs ) {
var script = sproc.Script( ScriptOption.SchemaQualify );
var scriptText = script[3];
}
When I access the script text it isn't putting the schema name (dbo) in front of the stored prcocedure. Can anyone explain this?