Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Get smo object from sql database item name

$
0
0
Hi all,Is there a way to get an smo object (stored proc, UDF, etc...) from an items' name and a database object?that is, without knowing what type of object xyz is, with the string "xyz" and a database object, can I get an smo object?$object = $objSrcDB.EnumObjects() | ?{$_.Name -eq $objName} gives me a System.Data.DataRow.If possible, I'd like to do it without getting into if ($Object.DatabaseObjectTypes -eq "StoredProcedure") {...}else if ($Object.DatabaseObjectTypes -eq "UDF") {...}... Thanks in advance,P

Viewing all articles
Browse latest Browse all 467

Trending Articles