Skip to content

Commit

Permalink
Support views in SQLServerGrammar (#37348)
Browse files Browse the repository at this point in the history
  • Loading branch information
madbarron authored May 11, 2021
1 parent 6277b39 commit f1b985b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Schema/Grammars/SqlServerGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function compileDropDatabaseIfExists($name)
*/
public function compileTableExists()
{
return "select * from sys.sysobjects where id = object_id(?, 'U')";
return "select * from sys.sysobjects where id = object_id(?) and xtype in ('U', 'V')";
}

/**
Expand All @@ -75,7 +75,7 @@ public function compileTableExists()
*/
public function compileColumnListing($table)
{
return "select name from sys.columns where object_id = object_id('$table', 'U')";
return "select name from sys.columns where object_id = object_id('$table')";
}

/**
Expand Down

0 comments on commit f1b985b

Please sign in to comment.