sql server get all database names code example

Example 1: show databases in sql server

SELECT * FROM SYS.DATABASES

Example 2: get database list in sql server

SELECT name FROM master.dbo.sysdatabases

Example 3: get table column names sql laravel

use Illuminate\Support\Facades\Schema;

use Illuminate\Support\Facades\DB;

public function getTableColumns($table)
{
    return DB::getSchemaBuilder()->getColumnListing($table);

    // OR

    return Schema::getColumnListing($table);

}

Example 4: show databases in sql server

SELECT * FROM SYS.SYSDATABASES

Example 5: show sql server database

EXEC sp_databases

Tags:

Php Example