Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Give NULL value a name in SQL View

Posted on 2014-01-12
3
Medium Priority
?
466 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

610 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