Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2013-01-31 : 03:13:39
|
Hi All,I am using below query to send email from batchDECLARE @CMD_loop varchar(8000)set @CMD_loop='ftp -i -s:E:\Tune\AT\cmds.txt ftp.XYZ.comif %ERRORLEVEL%==0 EXEC master..xp_cmdshell 'SQLCMD -S Server\GANGA-i"C:\FTP\mail.SQL"'where mail.sql consist of email sendign code which works perfectly in SSMS.Please help i am getting below errorSqlcmd: 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 cThanks,Gangadhara MSSQL Developer and DBA |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-01-31 : 08:34:39
|
See if remote connections are indeed enabled on your server. In SQL 2005, it is in the Surface Are Configuration utility (under the SQL 2005 program group). |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2013-02-01 : 02:21:13
|
Yes its enabled for Local and Remote connections -->using both TCP/IP and named pipes.Thanks,Gangadhara MSSQL Developer and DBA |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-02-01 : 07:49:17
|
Couple of thoughts/comments:1. I assume that Server is server name and GANGA is the named instance.2. The file C:\FTP\mail.SQL is on the local machine.Are able to run any commands at all? For example: xp_cmdshell 'sqlcmd -S Server\GANGA -Q "SELECT getdate()"' |
|
|
|
|
|