Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Requirements - Schedule task in SQL Express Edition.

But SQL server Agent functionality is not available in express edition.

Possible Solution- Schedule batch file execution to execute sql script. Tried

Batch File-
cmd /k sqlcmd -i backup.sql


Sql Script-
SQL
backup database DB_user1212 to disk = 'E:\backups\MyBackup.bak'
. But error occurred while executing sql script
A network related or instance specific error occurred while establishing a connection to SQL Server


Possible Reason- Something like connection string missing. Help me how to solve this, i am using windows authentication for connection.
Posted

1 solution

Chetan Saini wrote:
A network related or instance specific error occurred while establishing a connection to SQL Server

Basically, when you failed to connect to your SQL Server, the issue could be:
1) Network issue,
2) SQL Server configuration issue.
3) Firewall issue,
4) Client driver issue,
5) Application configuration issue.
6) Authentication and logon issue.
Check these
Steps to troubleshoot SQL connectivity issues[^]
SQL Server 2005 Connectivity Issue Troubleshoot - Part I[^]
Troubleshoot Connectivity Issue in SQL Server 2005 - Part II[^]
Troubleshoot Connectivity Issue in SQL Server 2005 - Part III[^]
 
Share this answer
 
Comments
Chetan Saini 7-Feb-14 8:04am    
But i think i had not specified connection which is the reason behind the error. I tried :Connect localhost[\SQLEXPRESS] [-l timeout]
backup database DB_user1212 to disk = 'E:\backups\MyBackup.bak'

but problem continued. Please suggest me how to do connection then only i should think of firewall, driver etc.
thatraja 7-Feb-14 8:08am    
Are you able to connect sql server(leave the backup process)? Try SQL management studio & login, verify
Chetan Saini 7-Feb-14 8:35am    
hello thatraja problem was with connection i tried cmd /k sqlcmd -S localhost\SQLEXPRESS -E -i E:\Work\Test Schedule task in sql express\backup.sql in batch file and it worked.
thatraja 7-Feb-14 8:49am    
Fine Hereafter do the same. Check the connection & go ahead with other things after that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900