SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


NOT BETWEEN


NOT BETWEEN

Author
Message
palotaiarpad
palotaiarpad
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: 2430 Visits: 804
Thanks for the easy QOTD!
Stuart Davies
Stuart Davies
SSCertifiable
SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)

Group: General Forum Members
Points: 7412 Visits: 4820
Easy point today - thanks Steve

-------------------------------Posting Data Etiquette - Jeff Moden Smart way to ask a questionThere are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan I would never join a club that would allow me as a member - Groucho Marx
Carlo Romagnano
Carlo Romagnano
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7532 Visits: 3397
cengland0 (3/30/2012)
This one was so easy that I was looking for the "trick." I kept look and looking but never found one so I finally submitted my answer. I was relieved to see that I got it right. The amount of tension waiting to see the "You got it right" message was overwhelming.

+1
I do not like qotd too easy or without tricks.
w00t

I run on tuttopodismo
Thomas Abraham
Thomas Abraham
Hall of Fame
Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)Hall of Fame (3.8K reputation)

Group: General Forum Members
Points: 3839 Visits: 2256
Carlo Romagnano (3/30/2012)
cengland0 (3/30/2012)
This one was so easy that I was looking for the "trick." I kept look and looking but never found one so I finally submitted my answer. I was relieved to see that I got it right. The amount of tension waiting to see the "You got it right" message was overwhelming.

+1
I do not like qotd too easy or without tricks.
w00t


I get paranoid when the question SEEMS too easy. Sometimes life really is that easy - strange but true. :-)

Please don't go. The drones need you. They look up to you.
Connect to me on LinkedIn
benkoskysa
benkoskysa
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 125
I guessed 2 because BETWEEN is inclusive, and then I tried to run it. I found out that I needed SQL Server 2008 compatibility, don't have that, only 2005, so I changed the VALUES clause to UNIONs, and the DATE to DATEtime, then fuond out I had to be logged in as dbo, don't have that either, so I took the dbo. off of the select, and then it returned two rows, voilà!

CREATE TABLE SalesDates
(id INT, saledate DATEtime
);
go
INSERT INTO SalesDates
SELECT
1, '2012/1/1'
UNION
SELECT
2, '2012/1/2'
UNION
SELECT
3, '2012/1/3'
UNION
SELECT
4, '2012/1/4'
UNION
SELECT
5, '2012/1/5'
UNION
SELECT
6, '2012/1/6';
go
SELECT id
FROM SalesDates s
WHERE s.saledate NOT BETWEEN '2012/1/2' AND '2012/1/5';
go
DROP TABLE SalesDates;
Dana Medley
Dana Medley
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3142 Visits: 1707
Nice n easy question to finish off the week. It's one of those, "No, it can't be this easy" kind of questions. Always looking for the QotD trick, but there was none...this time. (Insert evil laugh in background here, 'Muhahahaha' :laughSmile Great question.



Everything is awesome!
Danny Ocean
Danny Ocean
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2226 Visits: 1549
thx for easy point.

Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
www.GrowWithSql.com
DBA_Dom
DBA_Dom
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1026 Visits: 81110
I am a little surprised at the number of people that got this wrong. Maybe they read it wrong or looked at it too quickly. This is a straight back to basics logic question. While yes I agree with the others I was a little hesitant since it seemed too easy. Thanks for the nice light thinking after a long week.
jeff.mason
jeff.mason
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2709 Visits: 2137
Amazing that we are nearly 20 comments in and no one complained about the date format regional issue. Of course, that might be because the results would be the same in other regions....
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: General Forum Members
Points: 66931 Visits: 18570
dipmala.shende (3/30/2012)
Hi..
I got 1,6 as output..
I run this query on SQL server and got the same output.
Please let me know how we can get 2 as output.


The request was number of rows



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

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