Search code examples
sql-servergit-bashsqlcmd

How can I log into SQL Server via SQLCMD using Git Bash?


In my command prompt this seems working perfectly:

sqlcmd -S .\sqlexpress

But in my Git Bash this does not seem to work. It's giving:

Named Pipes Provider: Could not open a connection to SQL Server [53]. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.

As I stay in my Git Bash a lot, how can I log into my SQL Server via Git Bash without moving around often?


Solution

  • I guess I needed winpty for making login working:

    winpty sqlcmd -S .\\sqlexpress