diff --git a/lib/Cake/Model/Datasource/Database/Sqlserver.php b/lib/Cake/Model/Datasource/Database/Sqlserver.php index d99f8765a..b6b0c4bf2 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlserver.php +++ b/lib/Cake/Model/Datasource/Database/Sqlserver.php @@ -201,7 +201,8 @@ class Sqlserver extends DboSource { return $cache; } $fields = array(); - $table = $this->fullTableName($model, false); + $table = $this->fullTableName($model, false, false); + $schema = $model->schemaName; $cols = $this->_execute( "SELECT COLUMN_NAME as Field, @@ -212,7 +213,7 @@ class Sqlserver extends DboSource { COLUMNPROPERTY(OBJECT_ID('" . $table . "'), COLUMN_NAME, 'IsIdentity') as [Key], NUMERIC_SCALE as Size FROM INFORMATION_SCHEMA.COLUMNS - WHERE TABLE_NAME = '" . $table . "'" + WHERE TABLE_NAME = '" . $table . "'" . ($schema ? " AND TABLE_SCHEMA = '" . $schema . "'" : '') ); if (!$cols) { throw new CakeException(__d('cake_dev', 'Could not describe table for %s', $table));