2.8.20. Working with MS SQL

The hosting tools are available to work with external Microsoft SQL Server (MS SQL) databases.

Extension available by default Mssql.

Modules available:

Before using on the site, the extension must be enabled in list of extensions in PHP settings. IN console and cron modules are available by default.

With PDO:

$link = new PDO("sqlsrv:Server={$server};Database={$dbname}", $login, $passwd);
$link->query("select getdate()");


$link = sqlsrv_connect($server, ["Database"=>$dbname, "UID"=>$login, "PWD"=>$passwd]);
sqlsrv_query($link, "select getdate()");

In variables $server, $dbname, $login and $passwd соответственно должны быть хост сервера MS SQL, название базы данных, имя пользователя and пароль.