THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Denis Gobo

Summer SQL Teaser #8 Comments And Go

Without running the following two blocks of code what do you think will the output be?


/* code 1

SELECT GETDATE()

GO */

SELECT GETDATE()



/* code 2

SELECT GETDATE()

GO

*/

SELECT GETDATE()
Published Friday, July 20, 2007 1:56 PM by Denis Gobo
Filed under:

Comments

 

Chris J. Breisch said:

Piece of cake.

Now move the comment open-closes so they are: /* code 1 */, /* code 2 */ leaving four SELECT GETDATE() statements and two GO's.

July 20, 2007 1:36 PM
 

Adam Machanic said:

Hmmm, not your best effort :)

July 20, 2007 1:37 PM
 

Denis Gobo said:

Yeah, I am to 'busy' with my 6 month "become a better programmer" journey

I almost completely forgot about a teaser, I promise next week will be a better one or I will even come up with a better one over the weekend (no promise however)

July 20, 2007 1:47 PM
 

Luciano Evaristo Guerche said:

My 2 cents to this teaser.

/* code 1

SELECT GETDATE()

--GO

*/

SELECT GETDATE()

/* code 2

SELECT GETDATE()

--GO

*/

SELECT GETDATE()

July 20, 2007 2:19 PM
New Comments to this post are disabled

About Denis Gobo

I was born in Croatia in 1970, when I was one I moved to Amsterdam (and yes Ajax is THE team in Holland) and finally in 1993 I came to the US. I have lived in New York City for a bunch of years and currently live in Princeton, New Jersey with my wife and 3 kids. I work for Dow Jones as a Database architect in the indexes department, one drawback: since our data goes back all the way to May 1896 I cannot use smalldates ;-( I have been working with SQL server since version 6.5 and compared to all the other bloggers here I am a n00b. Some of you might know me from http://sqlservercode.blogspot.com/ or even from some of the newsgroups where I go by the name Denis the SQL Menace If you are a Tek-Tips user then you might know me by the name SQLDenis, I am one of the guys answering SQL Questions in the SQL Programming forum.

This Blog

Syndication

Privacy Statement