sql error on sp_dropserver while running whole query or debugging, but not when executing the individual line
Posted on 2011-03-23
In SQL Server 2008, I hae the following line just before adding the linked server back:
sp_dropserver 'SvrExcel', 'droplogins'
I realize I could check for the existence of SvrExcel, but this named server always exists for me because whenever I do one of many small data manipulation jobs, I overwrite it with the next one. I get the following message when I run it by executing the whole sql query, and also when I use the debug feature.
Msg 102, Level 15, State 1, Line 19
Incorrect syntax near 'sp_dropserver'.
However, I do not get the error message, and the command is successful, when I merely select the line and execute the one line.
Any clue as to why it would be showing an error while executing the whole query but not when executing the one line?