2006-08-21

COLLATE and Coalesce

I came across both of these items a while ago, but keep forgetting about them when i need to use them. The first is the COLLATE statement in T-SQL. Sometime different databases have different collations and when you try to query between them a collation error occurs. Now i used to always use one of the collations, ie collate Latin1_General_CS_AS. But i knew there was a default one, and i finally found it again (COLLATE database_default).
The other function Coalesce is a C# 2.0 item that does a thing similar to T-SQL's isnull()'s function. So:
string x = null;
string y = null;
string z = "123";
string value = x ?? y ?? z;
(value == "123") == true
So instead of using the :? statement checking nulls, it makes it alot cleaner.

4 comments:

Anonymous said...

Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

Anonymous said...

As a Newbie, I am always searching online for articles that can help me. Thank you Wow! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?

Anonymous said...

You might ask then how to detect a keylogger, the lies will be revealed and the truth will be exposed.
With the number of screenshot options, and you see exactly the keys you've typed. They have to take help of professionals.

oakleyses said...

michael kors outlet online, nike blazer pas cher, timberland pas cher, replica handbags, michael kors, sac hermes, coach outlet, ralph lauren uk, vans pas cher, burberry outlet, ray ban pas cher, michael kors outlet, burberry handbags, uggs outlet, mulberry uk, michael kors outlet, michael kors, converse pas cher, north face uk, polo lacoste, nike air max uk, michael kors outlet, abercrombie and fitch uk, nike air force, kate spade, oakley pas cher, nike air max uk, michael kors outlet online, true religion outlet, uggs outlet, north face, ray ban uk, michael kors outlet online, hollister pas cher, nike air max, nike tn, guess pas cher, nike roshe run uk, true religion jeans, true religion outlet, coach purses, sac vanessa bruno, michael kors outlet online, new balance, lululemon canada, nike free uk, hogan outlet, true religion outlet