private SqlTable MoveTableSchema(SqlTable table, SqlSchema newSchema)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }
            if (newSchema == null)
            {
                throw new ArgumentNullException("newSchema");
            }

            using (SqlConnection databaseConnection = new SqlConnection(GetConnectionString()))
                using (SqlCommand sqlCmd = new SqlCommand())
                {
                    sqlCmd.Connection  = databaseConnection;
                    sqlCmd.CommandText = string.Format(@"
                    alter schema {0}
                    transfer {1};",
                                                       newSchema.QuotedName,
                                                       table.FullyQuotedName);

                    databaseConnection.Open();
                    sqlCmd.ExecuteNonQuery();

                    SqlTable transferredTable = GetTable(newSchema.Name, table.ObjectName);

                    if (transferredTable == null)
                    {
                        throw new SqlDatabaseException("The table was expected to have moved schemas and something went wrong");
                    }

                    return(transferredTable);
                }
        }
        public SqlTable(int objectId, SqlSchema schema, string objectName, string quotedObjectName)
        {
            if (objectId == 0)
            {
                throw new ArgumentException("ObjectID cannot be zero");
            }
            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }
            if (string.IsNullOrWhiteSpace(objectName))
            {
                throw new ArgumentException("Object name cannot be null or empty");
            }
            if (string.IsNullOrWhiteSpace(quotedObjectName))
            {
                throw new ArgumentException("Quoted object name cannot be null or empty");
            }

            ObjectId         = objectId;
            ObjectName       = objectName;
            Schema           = schema;
            QuotedObjectName = quotedObjectName;
        }