This post provides the general syntax of SQL Server connection strings, just in case you find it hard to remember the syntax sometimes.

ODBC Connection Strings

Standard Security:

"Driver={SQLServer};Server=your_server_name; Database=your_database_name;Uid=your_username; Pwd=your_password;"

Trusted connection:

"Driver={SQLServer};Server=your_server_name; Database=your_database_name; Trusted_Connection=yes;"

SQL OLEDB Connection Strings

Standard Security:

"Provider=SQLOLEDB;Data Source=your_server_name; Initial Catalog= your_database_name; UserId=your_username; Password=your_password;"

Trusted connection:

"Provider=SQLOLEDB;Data Source=your_server_name; Initial Catalog=your_database_name; Integrated Security=SSPI;"

Connect via an IP address:

"Provider=SQLOLEDB;Data Source=your_remote_server_ip,1433; Network Library=DBMSSOCN; Initial Catalog=your_database_name; User ID=your_username;Password=your_password;"

At the end of the Data Source is the port to use (1433 is the default)

SQL SqlConnection .NET strings

Standard Security:

"Data Source=your_server_name;Initial Catalog= your_database_name; UserId=your_username; Password=your_password;"
"Server=your_server_name;Database=your_database_name; UserID=your_username; Password=your_password;Trusted_Connection=False"

Trusted connection:

"Data Source=your_server_name;Initial Catalog=your_database_name; Integrated Security=SSPI;"
"Server=your_server_name;Database=your_database_name; Trusted_Connection=True;"

Need a good GUI Tool for MS SQL Server? Try TablePlus, a modern, native tool for multiple databases including SQL Server, MySQL, PostgreSQL, SQLite, etc. And it’s free to use for as long as you need it to.

Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

On Linux? Download TablePlus for Linux

Need a quick edit on the go? Download TablePlus for iOS

TablePlus for MS SQL Server