Skip to content

Instantly share code, notes, and snippets.

@timyhac
Created June 23, 2016 02:38
Show Gist options
  • Save timyhac/d3da44d0d0d8dbabdba93ca9a4681c35 to your computer and use it in GitHub Desktop.
Save timyhac/d3da44d0d0d8dbabdba93ca9a4681c35 to your computer and use it in GitHub Desktop.
Test sql connection using sqlcmd
PS C:\> sqlcmd -S 'localhost\SQLEXPRESS' -U username -P RealPassword -Q "select getdate()"
-----------------------
2016-06-23 12:37:12.523
(1 rows affected)
PS C:\> sqlcmd -S 'localhost\SQLEXPRESS' -U -U username -P FakePassword -Q "select getdate()"
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login failed for user 'username'..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment