Exemplo n.º 1
0
        private string GetQuery( )
        {
            string cmdText = "";

            switch (cmbOperation.SelectedIndex)
            {
            case 0:
                cmdText = "DBCC SHOWCONTIG(" + ObjectId + ", " + IndexId.ToString() + ") WITH TABLERESULTS";
                break;

            case 1:
                cmdText = "DBCC CHECKTABLE('" + Utils.ReplaceQuatations(ObjectOwner + "." + ObjectName) + "', " + IndexId.ToString() + ") WITH TABLERESULTS";
                break;

            case 2:
                if (rbUseOriginal.Checked)
                {
                    cmdText = "DBCC DBREINDEX('" + Utils.ReplaceQuatations(ObjectOwner + "." + ObjectName) + "', '" + Utils.ReplaceQuatations(IndexName) + "')";
                }
                else if (rbReset.Checked)
                {
                    cmdText = "DBCC DBREINDEX('" + Utils.ReplaceQuatations(ObjectOwner + "." + ObjectName) + "', '" + Utils.ReplaceQuatations(IndexName) + "', " + maskedTextBox1.Text + ")";
                }
                break;

            case 3:
                cmdText = "DBCC SHOW_STATISTICS('" + Utils.ReplaceQuatations(ObjectOwner + "." + ObjectName) + "', " + Utils.Qualify(IndexName) + ")";
                break;

            case 4:

                string _command = "DBCC UPDATEUSAGE(0, '" + Utils.ReplaceQuatations(ObjectOwner + "." + ObjectName) + "', " + IndexId.ToString() + ")";
                if (chkWithCountRows.Checked)
                {
                    _command += " WITH COUNT_ROWS";
                }
                cmdText = _command;

                break;
            }
            return(cmdText);
        }
Exemplo n.º 2
0
 public override string ToString()
 {
     return(string.Format("Index: {0}, LastIndexedEtag: {1}", Index == null ? IndexId.ToString() : Index.PublicName, LastIndexedEtag));
 }