November 7, 2007 at 1:22 am
Pls tell me
karthik
November 7, 2007 at 9:10 am
I think they are the same
Pete
Peter Gadsby
Business Intelligence Consultant
www.hgconsult.co.uk
November 7, 2007 at 9:21 am
A) <>
B) !=
Both mean NOT EQUAL TO but (B) is not SQL 92 standard (The third version of SQL Server)
November 7, 2007 at 6:18 pm
I agree with Mayank... just to add to that, the != will actually appear in execution plans as <>. Sounds strange, but I can always tell who wrote the code if != is used... some Java programmer 😉
The reason I really don't like it is because 1) it's not what I'm accustomed to for identifying an inequality (used to <> because of Math) and 2) for some reason, it's hard for me to see when I'm reviewing code... I guess I just don't think there should be an = sign in an inequality 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
November 7, 2007 at 11:38 pm
Jeff Moden (11/7/2007)
Sounds strange, but I can always tell who wrote the code if != is used... some Java programmer 😉
😀 I always use !=, but I'm not a Java programmer. An old habit from my C background... 😉
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
November 8, 2007 at 12:02 am
Heh... I was going to include "C" programmers in that mix :D, but wasn't sure it was true and I work mostly with Java programmers to boot.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 9, 2007 at 2:20 am
!= is th inequality in C# get used to it as CLR programming takes off!:hehe:
Hiding under a desk from SSIS Implemenation Work :crazy:
November 9, 2007 at 3:45 am
Jeff Moden (11/7/2007)The reason I really don't like it is because 1) it's not what I'm accustomed to for identifying an inequality (used to <> because of Math) and 2) for some reason, it's hard for me to see when I'm reviewing code... I guess I just don't think there should be an = sign in an inequality 😉
The exact opposite for me.
I learnt != in maths so seeing <> has always been a wtf moment for me.
Just different notation dialects.
"!" being a shorthand for the logical NOT operator means != is almost instinctive for me.
Similarly I use "~" as shorthand for approx* whenever I am writing notes for myself.
November 9, 2007 at 7:00 am
Shaun McGuile (11/9/2007)
!= is th inequality in C# get used to it as CLR programming takes off!:hehe:
Heh... good point. But have had this argument with many other folks... there's very little you will ever need a CLR for if you actually know T-SQL well 😉 CLR's are for "C" programmers that don't 😛
--Jeff Moden
Change is inevitable... Change for the better is not.
November 9, 2007 at 7:12 am
Vincent Chute (11/9/2007)
The exact opposite for me.I learnt != in maths so seeing <> has always been a wtf moment for me.
Just different notation dialects.
"!" being a shorthand for the logical NOT operator means != is almost instinctive for me.
Similarly I use "~" as shorthand for approx* whenever I am writing notes for myself.
Perfect answer... "Just different notation dialects"...
Now, using the Tilde to represent approximation is something that I agree with!
--Jeff Moden
Change is inevitable... Change for the better is not.
November 9, 2007 at 8:57 am
These all give me the same query plan:
select * from authors where au_id <> '172-32-1176'
select * from authors where au_id != '172-32-1176'
select * from authors where not au_id = '172-32-1176'
November 9, 2007 at 5:07 pm
Heh... also notice that the != gets converted to a <> in the query plan output 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
November 13, 2007 at 12:55 am
Jeff Moden (11/9/2007)
Heh... good point. But have had this argument with many other folks... there's very little you will ever need a CLR for if you actually know T-SQL well 😉 CLR's are for "C" programmers that don't 😛
I'll disagree with you on that point. There's a lot of things that the CLR is better at than T-SQL. String manipulation, complex mathematical calculations, external calls (web service). All far easier and far faster from CLR functions/procs
Whether or not those belong in the DB in the first place is a different argument. 🙂
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
November 13, 2007 at 1:27 am
Sting manipulation? Complex mathematical calcs? Heh... Let's have a race... let's start with string manipulation... How about splitting a comma seperated column and returning a table with the PK of each row and the split value... 1 row for every split on a 100k row table? You write a CLR to solve, I'll write the T-SQL to solve. I'll even be happy to provide the test data if you want.
Or, how about doing Init Caps on a column in a million row table?
Or, how about removing all characters except digits and letters from a column in a million row table?
Or, name the problem...
...and here's your advantage... I don't have 2k5 to play with... I have to do it using only T-SQL 'cause I only have 2k. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
November 13, 2007 at 1:37 am
Jeff you rascal 😀
Hiding under a desk from SSIS Implemenation Work :crazy:
Viewing 15 posts - 1 through 15 (of 62 total)
You must be logged in to reply to this topic. Login to reply