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


NOT BETWEEN


NOT BETWEEN

Author
Message
palotaiarpad
palotaiarpad
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2112 Visits: 776
Thanks for the easy QOTD!
Stuart Davies
Stuart Davies
SSCertifiable
SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)

Group: General Forum Members
Points: 5358 Visits: 4694
Easy point today - thanks Steve

-------------------------------
Posting Data Etiquette - Jeff Moden
Smart way to ask a question

There 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 (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5075 Visits: 3327
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
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2777 Visits: 2255
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 (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)Valued Member (53 reputation)

Group: General Forum Members
Points: 53 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
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2524 Visits: 1696
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
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

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

Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
www.GrowWithSql.com
DBA_Dom
DBA_Dom
Say Hey Kid
Say Hey Kid (686 reputation)Say Hey Kid (686 reputation)Say Hey Kid (686 reputation)Say Hey Kid (686 reputation)Say Hey Kid (686 reputation)Say Hey Kid (686 reputation)Say Hey Kid (686 reputation)Say Hey Kid (686 reputation)

Group: General Forum Members
Points: 686 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
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1501 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-Dedicated
SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)

Group: General Forum Members
Points: 33326 Visits: 18560
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