Solved

Give NULL value a name in SQL View

Posted on 2014-01-12
3
429 Views
Last Modified: 2014-01-12
I have a view that I want to give a name to the "NULL" in the column  "Not Entered" would be the new value shown if it is "NULL"  if that makes sense...

Example of current Query
0
Comment
Question by:srodgers45
3 Comments
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 500 total points
ID: 39775113
You can do it as below
change your select in your query as below

SELECT top (100) <all your columns as is now except trans agency >, CASE WHEN FDC_trans_agencies.descr IS NULL THEN ' NOT ENTERED' ELSE FDC_trans_agencies.descr END as [trans agency] <followed by the where as is>

NOTE: in the above statement the statement are to be replaced with what I said including the <>....
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39775117
Use ISNULL

SELECT blah, blah, blah, ISNULL(column_name, 'Not Entered') as column_name
FROM your_table

COALESCE can also be used if you want to pull this off using more than one column, but for your question above ISNULL works.
0
 

Author Closing Comment

by:srodgers45
ID: 39775191
Thanks for the quick response. It worked...
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now