November 7, 2019 at 12:00 am
Comments posted to this topic are about the item Ending a line with a Backslash
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 7, 2019 at 7:48 am
I copied, pasted and ran the code as-is and got the wrong answer.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
November 7, 2019 at 8:05 am
Same with me, copied, ran the code and wrong answer.
The line in the published code ends with a space, not with a backslash.
November 7, 2019 at 8:53 am
This look like SSC's text parser then adding a space. Nothing i can do about that. Unfortuantely I had a pig getting the thing to even look correct due to SSC's text parser treating the backslashes as a line continuation character... For example I type this:
This is a linethis is another line
Image of what I typed:
And that'll be all on one in the published response.
The QOTD in the editor dosen't even have any backslashes anymore:
But why are you copying the code the get the answer in the first place..? 🙂
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 7, 2019 at 9:13 am
But why are you copying the code the get the answer in the first place..?
Trust but verify 🙂 Besides, a true smart-alec would have known that a '\' would be a line continuation but '\ ' wouldn't be and they'd have seen the space and got it wrong.
Don't get me wrong Thom, I had no doubt this wasn't your fault.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
November 7, 2019 at 9:46 am
the code has a space after the backslash, works without problem
November 7, 2019 at 10:11 am
November 7, 2019 at 10:15 am
I've resubmitted the question; hopefully the space isn't at the end any more, but it's very difficult to tell in SSC's editor I'm afraid, as it rips out of the backslashes after i submit the question. Will need to wait for it to be approved though.
Looks like regardless of what I do now, SSC breaks on the the continuation character. Apologies but I can't fix this. I'll send an email to the webmaster.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 7, 2019 at 12:51 pm
But why are you copying the code the get the answer in the first place..?
Because I got a "Wrong Answer" when everything I saw before me should execute without problem.
November 7, 2019 at 1:08 pm
Just got a bounce back from the "webmaster", as the email address is mispelt on the Contributions page (it has sqlservercental.com not sqlservercentral.com). Forwarded it to the correct address.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 7, 2019 at 3:06 pm
I got it wrong through ignorance rather than being a smart-alec. It might be obvious to some but it didn’t occur to me that a backlash at the end of the line would act as a line continuation, so despite the issues others have already mentioned, for me it was a good question as I learned something new.
November 7, 2019 at 3:08 pm
A nice gotcha warning. I was looking for permission related issues on the ImageFiles table, and not reading the title of the question.
November 7, 2019 at 8:32 pm
I got it wrong, but it was because I expected the stored procedure to fail to get created. I am a bit surprised that the stored procedure would get created with the second value of the insert missing and missing the closing bracket... but I suppose since it is just a string value being stored in that variable, the error wouldn't get thrown until you went to execute the dynamic SQL. So makes sense. I just didn't think about it enough before hitting submit.
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.
November 8, 2019 at 9:41 am
Inside dynamic sql I prefer to use the /**/ comment to avoid bug in concatenation.
Well Done.
November 11, 2019 at 4:54 am
Really interesting topic, thanks
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply