Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Site Related Forums
 The Yak Corral
 IsNull - my favourite function

Author  Topic 

leeholden
Starting Member

34 Posts

Posted - 2002-04-12 : 10:29:30
IsNull is my favourite function, it makes me all hot and sweaty when I get the chance to use it. In my lunch hour I trawl through old stored procedures looking for an opportunity to implement my favourite function. At weekends I hack into other peoples SQL servers and issue the command:

replace "case when <col_name> is null then <replace_value> else <col_name> end" with "IsNull(<col_name>,<replace_value>)"

I've created a whole website dedicated to this marvelous function - www.isnullisgreat.com - so others can bask in all it's glory. All I ask is a comedy tie from all that benefit from my obsession (I'm just missing the one with picture of the computer with a real life mouse attached by it's tail - very funny).

IsNull is my favourite function. What's yours?

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-04-12 : 10:34:46
OK

Please put the crack pipe down and SLOWLY back AWAY from your SQL Server.

We don't want any trouble.

Damian
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2002-04-12 : 10:40:11
Have to say that by favourite function is GetBeer().

Go to Top of Page

jongregg
Starting Member

31 Posts

Posted - 2002-04-12 : 11:05:10
I would have to say my favourite function is:

DECLARE @strRESULT varchar(100)

SET @strRESULT = WhosTheCowboyCoder()

PRINT @strRESULT

with the result

Lee_Holden

Go to Top of Page

leeholden
Starting Member

34 Posts

Posted - 2002-04-12 : 11:19:23
Merkin, I need it to help me through the day and protect me from the nasty pixies. Is it a late night or an early morning for you down there in Oz? On an SQL forum at 2 in the morning and you think I'm strange.

timmy, trust the english man to GetBeer() where time between 00:01 and 23:59.

john, HORSE!

Cowboy Coders R Us
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2002-04-12 : 11:45:08
quote:

IsNull is my favourite function. What's yours?


COALESCE -- takes more arguments, has saner type handling and is ANSI.


Edited by - Arnold Fribble on 04/12/2002 11:54:50
Go to Top of Page

dsdeming

479 Posts

Posted - 2002-04-12 : 12:50:33
I'd have to agree with Armold. I use COALESCE instead because it's ANSI standard although I understand MS may have optimized the ISNULL function so it's more efficient.

Where can I get my hands on the GetBeer() function? Sounds intriguing.

Go to Top of Page

leeholden
Starting Member

34 Posts

Posted - 2002-04-17 : 10:37:52
Mmmmm... COALESCE...
I've never used that function before, looks nice and sexy. Havn't found any application for it just yet (other than COALESCE(col1, 'Null Value')), but I will.

Takes me back to my old functional programming days, Theory(1), Practical(1), GetBeer(35)...

-------------------------
Cowboy Coders R Us
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-17 : 11:36:03
I like playing with charindex

--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -