File tree Expand file tree Collapse file tree
docs/relational-databases/server-management-objects-smo/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public static void CreatingAndUpdatingStatistics()
6565 var db = srv .Databases [" AdventureWorks" ];
6666
6767 // Reference the CreditCard table.
68- var tb = db .Tables [" CreditCard" , " dbo " ];
68+ var tb = db .Tables [" CreditCard" , " Sales " ];
6969
7070 // Define a Statistic object by supplying the parent table and name
7171 // arguments in the constructor.
@@ -81,10 +81,12 @@ public static void CreatingAndUpdatingStatistics()
8181
8282 // List all the statistics object on the table (you will see the newly created one)
8383 foreach (var s in tb .Statistics .Cast <Statistic >())
84- Console .WriteLine ($" {s .ID }\t {s .Name }" );
84+ Console .WriteLine ($" {s .ID }\t {s .Name }" );
8585
86- // Output:
87- // 2 Test_Statistics
86+ // Output:
87+ // 2 AK_CreditCard_CardNumber
88+ // 1 PK_CreditCard_CreditCardID
89+ // 3 Test_Statistics
8890 }
8991```
9092
@@ -118,4 +120,12 @@ $stat.Create()
118120
119121# Finally dump all the statistics (you can see the newly created one at the bottom)
120122$tb.Statistics
121- ```
123+
124+ # Output:
125+ # Name Last Updated Is From Index Statistic Columns
126+ # Creation
127+ # ---- ------------ -------------- -----------------
128+ # AK_CreditCard_CardNumber 10/27/2017 2:33 PM True {CardNumber}
129+ # PK_CreditCard_CreditCardID 10/27/2017 2:33 PM True {CreditCardID}
130+ # Test_Statistics 6/4/2020 8:11 PM False {CardType}
131+ ```
You can’t perform that action at this time.
0 commit comments