Viewing 15 posts - 286 through 300 (of 819 total)
Strange, but the version with PIVOT is a bit slower than that with GROUP BY. See execution plan!
with c
as(
SELECT * FROM (VALUES
(1,2013,1,100)
,(1,2013,1,200)
,(1,2014,0,500)
,(1,2014,1,200)
,(2,2013,1,200)
,(2,2013,1,200)
,(2,2014,1,100)
,(2,2014,1,100)
) AS V([Customer],[Salesyear],[Complete],[Amount])
)
SELECT
*
FROM...
January 27, 2015 at 2:28 am
Extremely easy!
Why do people get it wrong?
I expected 100% of correct answers!
😀
January 23, 2015 at 1:00 am
Hugo Kornelis (1/22/2015)
Carlo Romagnano (1/22/2015)
Hugo Kornelis (1/22/2015)
January 22, 2015 at 7:43 am
Hugo Kornelis (1/22/2015)
January 22, 2015 at 2:46 am
rmechaber (1/21/2015)
Some additional explanation from BOL (https://msdn.microsoft.com/en-us/library/ms175523%28v=sql.105%29.aspx):
If a run-time statement error (such as a constraint violation) occurs in a batch, the default behavior in the...
January 22, 2015 at 12:55 am
Koen Verbeeck (1/20/2015)
Hence, the "correct" answer is incorrect.
(I though I was losing my...
January 20, 2015 at 1:18 am
TomThomson (1/19/2015)
But I don't like the last sentence of the explanation
Transaction started by "BEGIN TRAN" may end prematurely and unexpected by some errors that may ROLLBACK transaction....
January 19, 2015 at 9:04 am
edwardwill (1/19/2015)
I would have found this easier if there had actually been a question.
That's true!
The question is "select six TRUE answer". It's "implicit".
🙂
January 19, 2015 at 2:11 am
richxs (1/12/2015)
Interesting, if I run this in SQL Management Studio I get 0,0,2,2,1but if I run it from TOAD for SQL Server I get 2,2,3,3,2
From BOL:
Implicit transactions may unexpectedly be...
January 12, 2015 at 2:04 am
TomThomson (1/10/2015)
I think that having BEGIN TRANSACTION increment trancount by 2 instead of 1 is utterly silly. It's a really nasty trap that can cause pointless and damaging...
January 11, 2015 at 10:05 am
Another bad worded qotd:
My result.
Msg 515, Level 16, State 2, Line 7
Impossibile inserire il valore NULL nella colonna 'b' della tabella 'tempdb.dbo.#a__________________________________________________________________________________________________________________000000000211'. La colonna non ammette valori Null. INSERT avrà ...
January 8, 2015 at 1:08 am
Rune Bivrin (1/7/2015)
Not fond of this question.COUNT(*) counts NULL:s, but COUNT(<expression>) doesn't.
select count(*), count(a)
from (values (1), (NULL)) x(a)
And GROUPING most certainly considers NULL:s.
+1
🙂
January 7, 2015 at 1:22 am
alter TABLE dbo.ActualOrders
with nocheck
add constraint o check(OrderDate between '20140101' and '20141231')
alter TABLE dbo.HistoryOrders
with nocheck
add constraint oo check(OrderDate between '20100101' and '20131231')
In this case the check is added, the optimizer...
January 6, 2015 at 2:52 am
Bob Cullen-434885 (1/6/2015)
January 6, 2015 at 2:47 am
patricklambin (12/30/2014)
Warning! The maximum key length is 900 bytes. The index 'PK__QoTD__2CB664DD844B62FA'...
December 30, 2014 at 2:50 am
Viewing 15 posts - 286 through 300 (of 819 total)