0

I have a CreateAll.tt template in a Visual Studio project. All the scripts I try to execute are correct - the template is tested on a different machine with SQL Server 2012 Developer Edition and it works perfectly fine.

On my computer with SQL Server 2012 Express instance however, i get the following error:

============== STDERR ==============
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Named Pipes Provider: Could not open a connection to SQL Server [2]. .
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout expired.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.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 11.0 : Named Pipes Provider: Could not open a connection to SQL Server [2]. .
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout expired.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.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..


============== EXITCODE ==============
1

I already tried the suggestions given here: http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/

  • Well, sounds like you haven't specified the server name correctly. Are you using . or localhost instead of .\SQLEXPRESS or localhost\SQLEXPRESS? Does your connection string have any nonsense about AttachDbFileName or user instances? – Aaron Bertrand Aug 13 '14 at 19:38
  • Actually I had forgotten to uncomment the correct connection string (I have 2 for each machine I'm working on). Now it's .\SQLEXPRESS but I keep getting the same error. The project has just SQL scripts and the connection string is in another project of the same solution. I don't have AttachDbFilename in the string. – Rosen Dimov Aug 13 '14 at 20:44
  • I also tried disabling the Windows firewall. This didn't help either. – Rosen Dimov Aug 13 '14 at 21:03
  • And have you tried connecting to .\SQLEXPRESS from any other approach, like SSMS or SQLCMD? Are you sure the service is running and that you've enabled remote connections? – Aaron Bertrand Aug 13 '14 at 21:05
  • Without a doubt, I didn't have any problems with SSMS whenever I used it. About SQLCMD - I tried the command in step 1 of the article I have given lik to and got the following output in the console: s17.postimg.org/ijt1x65db/sql.png Remote connections are enabled. – Rosen Dimov Aug 13 '14 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.