Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Subtle Line Feed / Carriage Return issue


Subtle Line Feed / Carriage Return issue

Author
Message
kaspencer
kaspencer
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2389 Visits: 814
Check your answer properly before submitting a question, because your so-called "correct answer" is wrong.
And so:
1. Go to the back of the class;
2. stand in the corner;
3. And wear a dunce's hat for three hours.
And see me after school.
And give me my point Mr Steve Thingimygig.

Ken.

You never know: reading my book: "All about your computer" might just tell you something you never knew!
lulu.com/kaspencer
savosin_sergey
savosin_sergey
SSC Journeyman
SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)SSC Journeyman (77 reputation)

Group: General Forum Members
Points: 77 Visits: 37
By the way, they say in BOL 2008:
Each Transact-SQL statement should be terminated with a semicolon. This requirement is not enforced, but the ability to end a statement without a semicolon is deprecated and may be removed in a future version of Microsoft SQL Server.


Nikunj Mistry
Nikunj Mistry
SSC Journeyman
SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)

Group: General Forum Members
Points: 93 Visits: 62
hi, i got answer 1,2,3,4
Toreador
Toreador
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2421 Visits: 8064
Rune Bivrin (12/23/2010)
While I find the question slightly pointless, I have to say I'm more than a little surprised that so many got it wrong. The question made it perfectly clear that 1,2,3,4 wouldn't be correct.


The question did indeed make it clear that it wouldn't be 1,2,3,4. I couldn't work out by looking at it how it could give any other answer, so I ran it and got 1,2,3,4.

That's how I got it wrong, and I assume that most people will have done something similar. Therefore I'm surprised that so many people got it right! There must be more people still using unsupported versions than I'd have predicted.
paul.knibbs
paul.knibbs
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1990 Visits: 6214
mtassin (12/23/2010)
Just FYI, different Operating systems do it differently anyway.

I'm pretty sure Unix/Linux doesn't put both CR and LF (Carriage Return and Line Feed) characters at the end of a line in a text file.


It doesn't, and neither did the Mac (even before it became UNIX derived with Mac OS X). However, I think they both use LF alone (0xA) as the line terminator--I've never encountered an OS that uses CR alone as a line terminator, but there may well be one out there!
SarbjitSingh.Gugnani
SarbjitSingh.Gugnani
SSC Journeyman
SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)

Group: General Forum Members
Points: 94 Visits: 21
'Question of the day' is definitely such a favorite for so many. This is my second time in less than a month having lost points in spite of having answered in accordance with the output in SQL Server. The first time, the points were granted. Hope is still alive for this one!
;-)

What you see...
-----------------------
print 1
-- Comment one
print 2
-- Comment two
print 3
-- Comment three
print 4

is not what you get!
-----------------------
1
2
3
4
UMG Developer
UMG Developer
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2280 Visits: 2204
Only correct for 2005 RTM? Can't say as I like this question...
jbwa
jbwa
SSC Veteran
SSC Veteran (290 reputation)SSC Veteran (290 reputation)SSC Veteran (290 reputation)SSC Veteran (290 reputation)SSC Veteran (290 reputation)SSC Veteran (290 reputation)SSC Veteran (290 reputation)SSC Veteran (290 reputation)

Group: General Forum Members
Points: 290 Visits: 214
I too get 1, 2, 3, 4.
dteemant
dteemant
SSC-Enthusiastic
SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)SSC-Enthusiastic (104 reputation)

Group: General Forum Members
Points: 104 Visits: 68
Using SQL SMSS 2008 I got 1,2,3,4 as well...

I have run into similar problems using -- as a commenting method, though never in SMSS. Once my sql scripts are implemented (as is specific to my employer), they are executed in their entirety as a single line. This causes ALL code after the --'s to become disabled. When comments are necessary in my scripts, I use /* to make my comments */ and avoid this problem.
dbuendiab
dbuendiab
SSC Journeyman
SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)SSC Journeyman (95 reputation)

Group: General Forum Members
Points: 95 Visits: 218
Dear friends:

I'm a little disappointed after reading the comments of this forum. Few people have liked or commented on the anomalous behavior described, and most, rude apart, are concentrated in two categories:
1) Give me back my point.
2) Have had the SP updated.

With the former, I apologized a few posts back for the disgust. Formally, it is true that the question is misleading. However, I do not agree with them that the game point lost is more relevant than the fact of learning something, even something you think that never in life is going to happen. In short, I think that curiosity must be above the game, but hey, it's my personal opinion.

For the latter, also explained above the reasons why the SP is not updated (for those not wishing to look for, suffice to say that our servers are outsourced. The administration is out of reach, and we can only report the situation , which we have already done.) Thank you for the information on the nature of the problem and its possible solution by updating. However, it goes without being condescending, because no match will guarantee you will not find one day a problem you don't know how to solve, and you'll like a sympathetic attitude (I suppose).

I have spent many years programming, I suffered a lot of headaches, especially in the beginning when everything was more handmade and generally incompatible. Now the problems are usually more routine, but every once in a while you find something like this, flashy, and then I feel surprised as a kid when we find the solution. That surprise is what I would have like to share with you and only a few have appreciated it, which I regret.

Without acrimony, greetings to all of you,
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search