Database Reference
In-Depth Information
# Loop forever
while(1 -ne 0)
{
foreach($row in $ProdDataSet.Tables[0])
{
$SqlConnection.Open()
$ProductId = $row[0]
$WhereCmd.Parameters["@ProductID"].Value = $ProductId
$WhereCmd.ExecuteNonQuery() | Out-Null
$SqlConnection.Close()
foreach($row in $EmpDataSet.Tables[0])
{
$SqlConnection.Open()
$EmpId = $row[0]
$ManCmd.Parameters["@EmpID"].Value = $EmpId
$ManCmd.ExecuteNonQuery() | Out-Null
$SqlConnection.Close()
}
$SqlConnection.Open()
$BomCmd.Parameters["@ProductID"].Value = $ProductId
$BomCmd.ExecuteNonQuery() | Out-Null
$SpecCmd.ExecuteNonQuery() | Out-Null
$SqlConnection.Close()
}
}
■
For more information on powershell, check out
Windows PowerShell
by Don Jones and Jeffrey hicks
(sapien, 2010).
Note
Once you've created the trace file, open the Database Engine Tuning Advisor. It defaults to a file type, so you'll
only have to browse to the trace file location. As before, you'll want to select the
AdventureWorks2012
database as the
database for workload analysis from the drop-down list. To limit the suggestions, also select
AdventureWorks2012
from the list of databases at the bottom of the screen. Set the appropriate tuning options and start the analysis. This
time, it will take more than a minute to run (see Figure
10-12
).