Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,556 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,348 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! 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
post 4 Aug, 2008 - 12:52 AM
Post #1


New D.I.C Head

*
Joined: 4 Aug, 2008
Posts: 1

Please help me
User is offlineProfile CardPM

Go to the top of the page


dineeshd
post 4 Aug, 2008 - 01:41 AM
Post #2


D.I.C Regular

Group Icon
Joined: 30 Jun, 2008
Posts: 407



Thanked 11 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

Go to the top of the page

PsychoCoder
post 4 Aug, 2008 - 01:48 AM
Post #3


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,249



Thanked 52 times

Dream Kudos: 7775

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI, 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 online!Profile CardPM

Go to the top of the page

dineeshd
post 4 Aug, 2008 - 01:55 AM
Post #4


D.I.C Regular

Group Icon
Joined: 30 Jun, 2008
Posts: 407



Thanked 11 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

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/7/08 11:08PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month