texting error in ssms when produce output

motioneye
motioneye used Ask the Experts™
on
Guys,
I have one weird problem, Ok , I have a practice to  copy all my working syntax  to Office notes but then if I  copy - paste again the syntax to ssms query output, I  have a problems as per my screenshot.

 ssms_error.PNG
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Guy,

Let me just copy the syntax here , pls you can try

select @@servername -- This is copy and paste from Microsoft office notes
go
select @@servername -- This is typing
Nakul VachhrajaniTechnical Architect, Capgemini India
Commented:
I suspect you have a special character(s) sneaking in. It happens when switching to and from an application that supports HTML or represents tabs and spaces in a different way. If you have a binary editor, suggest you paste the problem string there and I am sure you will find something that's not a space or a tab, but looks like a space in the editor.
IT Engineer
Distinguished Expert 2017
Commented:
Unfortunally this sometimes happens in Windows environment. First time I face something similar was more than 20 years ago with Windows 3.1 and the issue persists.
Copy/paste between applications can bring some hidden characters so when this happens only solution is to type the command yourself to be clear of unwanted characters.
Top Expert 2012

Commented:
"--" in MS Office is converted to "–" , hence your problem.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial