Last post May 14, 2009 08:08 AM by DigitalRick
May 04, 2007 06:03 PM|Code_warriors|LINK
I cannot get SQLCMD to run. When I run it, it appears for a few seconds then dissappears. I tried running it in cmd and it says it cannot run because the default setting for SQL server does not allow remote connections. Please help.
May 04, 2007 07:22 PM|TATWORTH|LINK
On the server concerned, you need to get your DBA to go:
May 05, 2007 01:58 AM|TATWORTH|LINK
May 05, 2007 05:00 PM|Code_warriors|LINK
May 05, 2007 06:27 PM|TATWORTH|LINK
May 08, 2007 01:49 PM|Code_warriors|LINK
This is the message I get when I try to run sqlcmd in cmd prompt
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server .
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 setting SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
May 08, 2007 01:50 PM|Code_warriors|LINK
May 08, 2007 09:17 PM|Nai-Dong Jin - MSFT|LINK
In the Command Prompt window, pls type: sqlcmd -S myServer\instanceName
. For example: sqlcmd -S .\SQLEXPRESS
Maybe the database which you want to connect is not the default database on your machine,so pls give the instance name in the command.
Hope this helps. Thanks.
Jan 31, 2009 03:10 PM|Raju Keezhadathu|LINK
For those who still facing this error.
If you give the command line switch in lowercase you will get this error.
Try using uppercase "sqlcmd -S ....." intstead of " sqlcmd -s ....."
State 1 sqlcmd
May 13, 2009 03:49 PM|DigitalRick|LINK
WHat was the command that worked for you? I am getting an error myself, same as you but now I'm getting a syntax error
sqlcmd -S .\instancename -Q "BACKUP DATABASE <databasename> TO DISK 'C:\DB_Backups\<databasename>.BAK'"
I have to assume my code is wrong but I cannot get it.
All I want to do is the same as you. THe ability to backup the databases via script that cna then be added to a task schedule and run each night because SQL express does not include the agent anymore...
May 13, 2009 03:54 PM|gmmastros|LINK
It looks like you are missing an equal sign:
sqlcmd -S .\instancename -Q "BACKUP DATABASE <databasename> TO DISK
May 14, 2009 08:08 AM|DigitalRick|LINK
You are so correct !! Thast was it, the script works like a charm now !! Thank you so very much. <now to get some glue to put the hair I have been pulling out back into place> :-)
Thank you !! Rick