Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exec with hyphen in the server name failing with error 170

Status
Not open for further replies.
Sep 3, 2003
11
GB
I am trying to run the following command to execute a stored procedure on my DR server from my live server:

exec georgia-dr.logshipping.dbo.restore_database_backups

This is scheduled via a job on the live server. The job fails with the following message:

Error 170: Line 1: Incorrect syntax near 'dr'

I have tried parsing the statement with ' or " around the server name georgia-dr but these do not work either. Any ideas how I can make the job understand a hyphen in a server name?

 
DId you try putting brakets around the name. BTW you should never use hyphens or spaces in servernames to avoid these types of problems.
 
As SQLSister says: do this:

exec [georgia-dr].logshipping.dbo.restore_database_backups

-SQLBill
 
Unfortunately our Network team have adopted this format for our DR server names so there is little I can do to change the server name. Many thanks for your help. The square brackets work a treat!
 
You should tell them in writing with a copy to your boss and their boss that that their naming convention is a problem though. So that they change it for future servers. It really is bad to use names which require special handling.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top