May 29, 2008 at 8:06 am
On the cmd prompt I type the following:
sqlcmd -i "test.sql"
test.sql contains the following:
:CONNECT serverName\instanceName
I get this error:
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
Can someone pls help?
I can connect to this instance from SSMS.
__________________________________________________________________________________
SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
Persisting SQL Server Index-Usage Statistics with MERGE[/url]
Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]
May 29, 2008 at 8:11 am
I think I got it. I have to connect to an instance from the cmd line and THEN reconnect with the :CONNECT directive.
Like this:
On cmd prompt:
sqlcmd -S srvr1\instance1 -i "test.sql"
test.sql remains as is.
Apologies, it seems I was too trigger-happy to post this problem... 🙂
__________________________________________________________________________________
SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
Persisting SQL Server Index-Usage Statistics with MERGE[/url]
Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]
May 29, 2008 at 8:13 am
Is this a remote or local connection? You might need to set the user and password or perhaps the trusted connection switch in your command or in your file.
http://msdn.microsoft.com/en-us/library/ms162773.aspx
How are you connecting in SSMS? You provide a trusted connection or name password in there.
May 29, 2008 at 8:17 am
Steve Jones - Editor (5/29/2008)
Is this a remote or local connection? You might need to set the user and password or perhaps the trusted connection switch in your command or in your file.http://msdn.microsoft.com/en-us/library/ms162773.aspx
How are you connecting in SSMS? You provide a trusted connection or name password in there.
I think the -E flag is the default and is optional:
http://msdn.microsoft.com/en-us/library/ms180944.aspx
I provide a trusted connection when connecting through SSMS.
__________________________________________________________________________________
SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
Persisting SQL Server Index-Usage Statistics with MERGE[/url]
Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply