?
Solved

Give NULL value a name in SQL View

Posted on 2014-01-12
3
Medium Priority
?
462 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 2000 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 66

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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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
Suggested Courses

764 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