?
Solved

How can I convert a null column to a space when testing a integer column

Posted on 2012-08-15
1
Medium Priority
?
598 Views
Last Modified: 2013-11-19
Hello,

I have the following

SELECT       MakeID_NAPA,
              ISNULL(EngineID_NAPA, '') AS EngineID_NAPA,                  
FROM         NAPA_Catalog

where I check the EngineID_NAPA column for a null value.

Rather than replacing it with an integer I want to replace it with a space.  The above statement shows 0 rather than space.

I tried casting but the check is done before the cast with a resulting '0'

Any help is appreciated.

Thank you
0
Comment
Question by:Mevotech
1 Comment
 

Accepted Solution

by:
Mevotech earned 0 total points
ID: 38297226
Answered my own question by writing it out, just reversed the logic

ISNULL(CAST(EngineID_NAPA AS VARCHAR(3)),'') AS EngineID_NAPABlank,

and works.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

807 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