Welcome to Dream.In.Code
Become an Expert!

Join 150,140 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,301 people online right now. Registration is fast and FREE... Join Now!




In MS-Sql How check if a column value is null and replace it with othe

 
Reply to this topicStart new topic

In MS-Sql How check if a column value is null and replace it with othe

rohitphuge
3 Aug, 2008 - 11:52 PM
Post #1

New D.I.C Head
*

Joined: 3 Aug, 2008
Posts: 1

Please help me
User is offlineProfile CardPM
+Quote Post

dineeshd
RE: In MS-Sql How Check If A Column Value Is Null And Replace It With Othe
4 Aug, 2008 - 12:41 AM
Post #2

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 579



Thanked: 16 times
Dream Kudos: 575
My Contributions
SQL
SELECT ISNULL(COLUMN_NAME, REPLACE_STRING) FROM TABLE_NAME


Here "REPLACE_STRING" is the value you want to replace with if the column value is NULL.

Hope this is what you are looking for... rolleyes.gif
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: In MS-Sql How Check If A Column Value Is Null And Replace It With Othe
4 Aug, 2008 - 12:48 AM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
ISNULL() is indeed a good way to accomplish this task, but COALESCE has been proven to run a tad bit faster, and use less resources when executing. COALESCE is used like
sql

SELECT COALESCE(COLUMN_NAME, REPLACE_STRING) FROM TABLE_NAME


Hope that helps some smile.gif
User is offlineProfile CardPM
+Quote Post

dineeshd
RE: In MS-Sql How Check If A Column Value Is Null And Replace It With Othe
4 Aug, 2008 - 12:55 AM
Post #4

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 579



Thanked: 16 times
Dream Kudos: 575
My Contributions
QUOTE(PsychoCoder @ 4 Aug, 2008 - 02:18 PM) *
COALESCE has been proven to run a tad bit faster, and use less resources when executing.

Thanks for that information PsychoCoder I was not aware of that. smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:14AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month