July 9, 2014 at 11:00 am
GilaMonster (7/9/2014)
WHERE Coalesce(NotNullableColumn,-1) = 0
and CategoryID = @CategoryID
Group By CategoryID
......
Imo there is not necessarily something wrong with the group by.
The coalesce on the other hand is for people who have never heard of IS NOT NULL π
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 9, 2014 at 11:08 am
Koen Verbeeck (7/9/2014)
GilaMonster (7/9/2014)
WHERE Coalesce(NotNullableColumn,-1) = 0
and CategoryID = @CategoryID
Group By CategoryID
......
Imo there is not necessarily something wrong with the group by.
The coalesce on the other hand is for people who have never heard of IS NOT NULL π
In TSQL that would be
WHERE COMPREHEND(NULL) IS NULL
π
July 9, 2014 at 11:27 am
Koen Verbeeck (7/9/2014)
GilaMonster (7/9/2014)
WHERE Coalesce(NotNullableColumn,-1) = 0
and CategoryID = @CategoryID
Group By CategoryID
......
Imo there is not necessarily something wrong with the group by.
The coalesce on the other hand is for people who have never heard of IS NOT NULL π
Nevermind the column can't be null.:-D:-D
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
July 9, 2014 at 11:38 am
SQLRNNR (7/9/2014)
Koen Verbeeck (7/9/2014)
GilaMonster (7/9/2014)
WHERE Coalesce(NotNullableColumn,-1) = 0
and CategoryID = @CategoryID
Group By CategoryID
......
Imo there is not necessarily something wrong with the group by.
The coalesce on the other hand is for people who have never heard of IS NOT NULL π
Nevermind the column can't be null.:-D:-D
You never know, you might find something like this:
CREATE TABLE Categories(
CategoryID NVARCHAR(MAX) NULL,
NotNullableColumn NVARCHAR(MAX) NULL)
I'm sure that someone is capable of doing something like that. :w00t:
July 9, 2014 at 11:43 am
Luis Cazares (7/9/2014)
SQLRNNR (7/9/2014)
Koen Verbeeck (7/9/2014)
GilaMonster (7/9/2014)
WHERE Coalesce(NotNullableColumn,-1) = 0
and CategoryID = @CategoryID
Group By CategoryID
......
Imo there is not necessarily something wrong with the group by.
The coalesce on the other hand is for people who have never heard of IS NOT NULL π
Nevermind the column can't be null.:-D:-D
You never know, you might find something like this:
CREATE TABLE Categories(
CategoryID NVARCHAR(MAX) NULL,
NotNullableColumn NVARCHAR(MAX) NULL)
I'm sure that someone is capable of doing something like that. :w00t:
U U U UGLY
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
July 9, 2014 at 12:00 pm
Koen Verbeeck (7/9/2014)
GilaMonster (7/9/2014)
WHERE Coalesce(NotNullableColumn,-1) = 0
and CategoryID = @CategoryID
Group By CategoryID
......
Imo there is not necessarily something wrong with the group by.
The actual query was a little (lot) more complex and the group by was completely unnecessary. Whether the optimiser couldn't figure that out or what I don't know, but it was resulting in a sort being added to the plan.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 10, 2014 at 12:54 am
SQLRNNR (7/9/2014)
Koen Verbeeck (7/9/2014)
GilaMonster (7/9/2014)
WHERE Coalesce(NotNullableColumn,-1) = 0
and CategoryID = @CategoryID
Group By CategoryID
......
Imo there is not necessarily something wrong with the group by.
The coalesce on the other hand is for people who have never heard of IS NOT NULL π
Nevermind the column can't be null.:-D:-D
That doesn't matter. It might be used to filter out rows after a left outer join. (although I can imagine more efficient constructs)
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 10, 2014 at 12:57 am
GilaMonster (7/9/2014)
Koen Verbeeck (7/9/2014)
GilaMonster (7/9/2014)
WHERE Coalesce(NotNullableColumn,-1) = 0
and CategoryID = @CategoryID
Group By CategoryID
......
Imo there is not necessarily something wrong with the group by.
The actual query was a little (lot) more complex and the group by was completely unnecessary.
I can imagine the actual query being more complex (also having a SELECT and stuff like that :-D).
I was thinking along the lines of aggregations, but then probably other columns should have been included in the GROUP BY as well.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 10, 2014 at 4:32 am
So I tried to endorse Jeff on LinkedIn for BCP, but somehow it doesn't work.
I saw Jeff was endorsed 9 times for SSIS. That was cruel. π
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 10, 2014 at 7:38 am
Koen Verbeeck (7/10/2014)
So I tried to endorse Jeff on LinkedIn for BCP, but somehow it doesn't work.I saw Jeff was endorsed 9 times for SSIS. That was cruel. π
I don't know, I bet Jeff would write better SSIS packages than a lot of people who do it full-time.:w00t:
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
July 10, 2014 at 7:42 am
Jack Corbett (7/10/2014)
Koen Verbeeck (7/10/2014)
So I tried to endorse Jeff on LinkedIn for BCP, but somehow it doesn't work.I saw Jeff was endorsed 9 times for SSIS. That was cruel. π
I don't know, I bet Jeff would write better SSIS packages than a lot of people who do it full-time.:w00t:
I guess he would have just one Execute SQL Task that calls a stored procedure π
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 10, 2014 at 7:45 am
Koen Verbeeck (7/10/2014)
Jack Corbett (7/10/2014)
Koen Verbeeck (7/10/2014)
So I tried to endorse Jeff on LinkedIn for BCP, but somehow it doesn't work.I saw Jeff was endorsed 9 times for SSIS. That was cruel. π
I don't know, I bet Jeff would write better SSIS packages than a lot of people who do it full-time.:w00t:
I guess he would have just one Execute SQL Task that calls a stored procedure π
So would I - you wouldn't believe the cr@p SSIS tasks I've seen in the last couple of years. Gazillions of DCT's just because some oaf couldn't write decent TSQL.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 10, 2014 at 7:50 am
I get it. I'm not the brightest bulb in the box, but I can usually understand the logic of processing data most of the time. I'm utterly at a loss over here. Maybe this guy is making sense and I'm just too dense to understand. Maybe it's gibberish like it feels like. Maybe I'm tired. Could someone, nicely, try to help here?
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
July 10, 2014 at 7:56 am
Koen Verbeeck (7/10/2014)
Jack Corbett (7/10/2014)
Koen Verbeeck (7/10/2014)
So I tried to endorse Jeff on LinkedIn for BCP, but somehow it doesn't work.I saw Jeff was endorsed 9 times for SSIS. That was cruel. π
I don't know, I bet Jeff would write better SSIS packages than a lot of people who do it full-time.:w00t:
I guess he would have just one Execute SQL Task that calls a stored procedure π
Reminds me of a package I recently fixed that had the following.
Execute SQL task that executed a stored procedure, that called xp_cmdshell, executed a bat file, that executed sqlcmd that queried a table for a single value.
Yeah go figure.
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
July 10, 2014 at 7:57 am
Grant Fritchey (7/10/2014)
I get it. I'm not the brightest bulb in the box, but I can usually understand the logic of processing data most of the time. I'm utterly at a loss over here. Maybe this guy is making sense and I'm just too dense to understand. Maybe it's gibberish like it feels like. Maybe I'm tired. Could someone, nicely, try to help here?
Nope you are spot on. It is total gibberish and the poor person doesn't know enough to realize how screwed up their "structures" are. I would have answered but about all I would do is say much the same as you, except I might add that they should hire a consultant to help them unravel that mess.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 β Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 15 posts - 44,566 through 44,580 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply