January 5, 2011 at 11:58 pm
Oh crud... my apologies. Didn't mean to post (gasp!) code on "the thread". :pinch:
--Jeff Moden
Change is inevitable... Change for the better is not.
January 6, 2011 at 12:37 am
Craig Farrell (1/5/2011)
Of course, if you really want to mess with your own head, you can always assume because of graph charts and the like that -infinity = infinity, and the number line is actually a circle.
Isn't a straight line actually a circle with radius equal to infinity? (or something like that, I don't remember, high school is some time ago)
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
January 6, 2011 at 12:41 am
Koen (da-zero) (1/6/2011)
Craig Farrell (1/5/2011)
Of course, if you really want to mess with your own head, you can always assume because of graph charts and the like that -infinity = infinity, and the number line is actually a circle.Isn't a straight line actually a circle with radius equal to infinity? (or something like that, I don't remember, high school is some time ago)
Heheh, that's from the same inferred math concept. If I remember right the logic proof basically was circular as well. Before anyone quizzes the hell out of me on that though, I'm not a Math Doctorate. I just remember it as one of those 'fun theories' that one of my favorite professors used to use to keep us involved.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA
January 6, 2011 at 2:43 am
Jeff Moden (1/5/2011)
Personally, I'd prefer a NULL to be returned instead of an error...
Hmmm. That's an interesting question. I don't like the idea of NULL being overworked (yet again in SQL!) to represent 'attempt to divide by zero'. On balance, I think I prefer the error. You can't legitimately divide by zero, so it's a bug in my code, I would say. Otherwise, why stop there? What should LOG(x) return for x <= 0? NULL again?
By the way, the following also does what you prefer:
SET ANSI_WARNINGS, ARITHABORT OFF;
SELECT 1/0, LOG(-0);
SET ANSI_WARNINGS, ARITHABORT ON;
I resist using NULLIF and COALESCE because they can introduce subtle bugs (incorrect results). It seems safer, to me, to expand them into CASE expressions explicitly. The query parser does that anyway.
Paul
January 6, 2011 at 4:57 am
Brandie Tarvin (1/5/2011)
EDIT: Of course, the only reason I want to go on this cruise is for the Cruisiness of it (Caymans, Mexico). The SQL Classes themselves are for beginners.
I just received an email from SQLCruise this morning. It seems that people were complaining about this, so they have re-worked the schedule (with input from those already signed up). It might be worth your time now.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
January 6, 2011 at 4:59 am
Steve Jones - SSC Editor (1/5/2011)
Just came back from a neighborhood meeting. Now I need to go shovel more manure around in my barn.
So, is the second part related to the first part?
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
January 6, 2011 at 5:23 am
LutzM (1/5/2011)
GSquared (1/5/2011)
...Are you trying to imply that a lump of plastic, metal, and toxic semiconductors can't understand that it's supposed to do what I want, not what I told it to?
It's not limited to a lump of plastic. There are people showing exactly the same behavior.
Are those some kind of androids then? π
Does this mean that female users view computers as male?
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
January 6, 2011 at 5:29 am
Chris Morris-439714 (1/6/2011)
LutzM (1/5/2011)
GSquared (1/5/2011)
...Are you trying to imply that a lump of plastic, metal, and toxic semiconductors can't understand that it's supposed to do what I want, not what I told it to?
It's not limited to a lump of plastic. There are people showing exactly the same behavior.
Are those some kind of androids then? π
Does this mean that female users view computers as male?
We can't answer that question on account of the act of answering is a violation of the Femme-Manual NDA. Sorry.
January 6, 2011 at 5:41 am
SQLkiwi (1/6/2011)
Jeff Moden (1/5/2011)
Personally, I'd prefer a NULL to be returned instead of an error...Hmmm. That's an interesting question. I don't like the idea of NULL being overworked (yet again in SQL!) to represent 'attempt to divide by zero'. On balance, I think I prefer the error. You can't legitimately divide by zero, so it's a bug in my code, I would say. Otherwise, why stop there? What should LOG(x) return for x <= 0? NULL again?
By the way, the following also does what you prefer:
SET ANSI_WARNINGS, ARITHABORT OFF;
SELECT 1/0, LOG(-0);
SET ANSI_WARNINGS, ARITHABORT ON;
I resist using NULLIF and COALESCE because they can introduce subtle bugs (incorrect results). It seems safer, to me, to expand them into CASE expressions explicitly. The query parser does that anyway.
Paul
Not to insert a technical discussion here, but could you explain how NULLIF and COALESCE introduce subtle bugs. Perhaps start another thread and put the link here or an article or blog post?
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
January 6, 2011 at 5:44 am
I also want to encourage all you who are PASS members to opt-in to the session voting for SQLRally. See my this post which has a link to opt-in in case you didn't get the email from PASS.
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
January 6, 2011 at 6:02 am
Jack Corbett (1/6/2011)
Not to insert a technical discussion here, but could you explain how NULLIF and COALESCE introduce subtle bugs. Perhaps start another thread and put the link here or an article or blog post?
I mentioned it a couple of weeks ago on a Celko thread:
http://www.sqlservercentral.com/Forums/FindPost1036699.aspx
Slightly related, why ISNULL is more optimizer-friendly than COALESCE:
January 6, 2011 at 6:23 am
Jack Corbett (1/6/2011)
I also want to encourage all you who are PASS members to opt-in to the session voting for SQLRally. See my this post which has a link to opt-in in case you didn't get the email from PASS.
And everyone should vote for my sessions, or I will steal your favorite snackage from all the stores in the world and hold it for ransom until you do! Bwahahahahaha.
Seriously, though. Vote on sessions.
January 6, 2011 at 6:45 am
Brandie Tarvin (1/6/2011)
Chris Morris-439714 (1/6/2011)
LutzM (1/5/2011)
GSquared (1/5/2011)
...Are you trying to imply that a lump of plastic, metal, and toxic semiconductors can't understand that it's supposed to do what I want, not what I told it to?
It's not limited to a lump of plastic. There are people showing exactly the same behavior.
Are those some kind of androids then? π
Does this mean that female users view computers as male?
We can't answer that question on account of the act of answering is a violation of the Femme-Manual NDA. Sorry.
I had a glimpse of that once, just one page. It was all questions and answers.
Q: If he asks this...
A: It depends.
All of the answers were "It depends"!
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
January 6, 2011 at 7:04 am
SQLkiwi (1/6/2011)
Jack Corbett (1/6/2011)
Not to insert a technical discussion here, but could you explain how NULLIF and COALESCE introduce subtle bugs. Perhaps start another thread and put the link here or an article or blog post?I mentioned it a couple of weeks ago on a Celko thread:
http://www.sqlservercentral.com/Forums/FindPost1036699.aspx
Slightly related, why ISNULL is more optimizer-friendly than COALESCE:
Thanks. I use ISNULL when only evaluating 2 values and COALESCE when more than 2.
I believe they way they deal with different data types in the arguments is different as well.
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
January 6, 2011 at 7:20 am
Brandie Tarvin (1/6/2011)
Jack Corbett (1/6/2011)
I also want to encourage all you who are PASS members to opt-in to the session voting for SQLRally. See my this post which has a link to opt-in in case you didn't get the email from PASS.And everyone should vote for my sessions, or I will steal your favorite snackage from all the stores in the world and hold it for ransom until you do! Bwahahahahaha.
But only if her session doesn't conflict with mine... they you need to vote for mine! :w00t: π π
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 15 posts - 22,981 through 22,995 (of 66,749 total)
You must be logged in to reply to this topic. Login to reply