December 23, 2010 at 7:16 am
Looking at too much script makes my head swim, now I can't make heads or tails of it. But I, too, got 1,2,3,4.
December 23, 2010 at 7:21 am
dbuendiab (12/23/2010)
Anyway, I admit it was a sure-you-lose-question.
There are other ways to get points.
The only loss here is your time for what looks like a cut and paste error.
:w00t:
December 23, 2010 at 7:23 am
This was removed by the editor as SPAM
December 23, 2010 at 7:23 am
Carlo Romagnano (12/23/2010)
Some tools (powerbuilder,qlick) replace CR and LF with space, so one line commentin the script could alter the command.
Running the script in sql2000 I get 1,3,4 but in sql2005 + sp I get 1,2,3,4.
Running script in PowerBuilder I get just a comment
-- comment 1 print 1 -- comment 2 print 2, etc.
What about Quick Base or FileMaker?
I would guess they get the same result.
December 23, 2010 at 7:28 am
Might as well add me to the list of having the right answer and getting it marked wrong.
A QotD on a bug that has been fixed for years is a poor QotD
December 23, 2010 at 7:32 am
stewartc-708166 (12/23/2010)
par for the course....CR was a placemarker character, left over from the old typeset days, which told the typesetter to go to the begining of a line (or the first available space thereafter). It was thus used in conjunction with the NL character which, without it, would cause the cursor to go to the next line, but continue from the same position.
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. As I've learned when I open said documents in notepad. Other text editors for Windows (Programmers File Editor as an example) treat the one character (instead of two) text files with no trouble and open them up with formatting intact.
December 23, 2010 at 7:36 am
I got 1,2,3,4 as a result too.
December 23, 2010 at 7:38 am
SQL 2005 provides the following output:
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
Need to correct your answer.
Raymond Laubert
Exceptional DBA of 2009 Finalist
MCT, MCDBA, MCITP:SQL 2005 Admin,
MCSE, OCP:10g
December 23, 2010 at 8:15 am
Good question but wrongly framed.
Oh......I lost a point too. Damn, Bad beginning for a Christmas eve.
SQL DBA.
December 23, 2010 at 8:21 am
Ran this under SQL Server 2005 SP3 (9.0.4053) and got following results:
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
Interestingly, in Management Studio the '-- Comment one' and 'print 2' display on separate lines and apparently are parsed that way, but when copied/pasted into this window they are combined on the same line. This could have been a better question, with answers that don't depend on an unpatched old version of SQL Server.
December 23, 2010 at 8:24 am
Bug must be fixed in 2008:
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
Ted Seeber
I find your secrets in your data.
http://www.informaitonr.us
December 23, 2010 at 8:27 am
Only if you've failed in the server patch department- this was fixed SQL Server 2005 SP1
Ted Seeber
I find your secrets in your data.
http://www.informaitonr.us
December 23, 2010 at 8:58 am
Thanks for the question. It would have been nice to have something a little more current.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 23, 2010 at 9:26 am
I also got 1,2,3,4 so not sure what the question was trying to show - no bug here!
December 23, 2010 at 10:01 am
the question would have been alright in 2005 when that was an issue
so the only people to get the question right were people have fully patched sql 2005
Viewing 15 posts - 31 through 45 (of 66 total)
You must be logged in to reply to this topic. Login to reply