Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

SMO Table collections issue

$
0
0

Guys,

I am having issues in my script when am querying the collection objects in latest SMO (SQl 2012)

Using Microsoft.SqlServer.Smo, Version=9.0.242.0 below line returns valid table object.

$table = $db.Tables[$tablename]  

But using Microsoft.SqlServer.Smo, Version=11.0.0.0 the above line doesn't return anything so I am doing something like this to get table object.

$table = $db.Tables | Where-object {$_.name -eq $tablename}. this returns the table object I am looking for.

I have other similar issues when I am querying the collection objects.

For ex;
$procObject = $server.Databases[$database].StoredProcedures[$procname] (Doesn't work using latest SMO but works fine using older SMO)

And I verified that the stored proc is in the StoredProcedures collection.

Did this change in SQL 2012 SMO? 


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>