<p>How do I connect to a MSSQL database using Perl's DBI module in Windows?</p>

Couldn't find this anywhere reliable. Use Perl code similar to
```
```
use DBI;
my $dbs = "dbi:ODBC:DRIVER={SQL Server};SERVER={ServerName}";
my ($username, $password) = ('username', 'password');

my $dbh = DBI->connect($dbs, $username, $password);

if (defined($dbh))
{
    #write code here
    $dbh->disconnect;
}
else
{
    print "Error connecting to database: Error $DBI::err - $DBI::errstr\n";
}
```
```