Hi,
I feel so stupid to ask this question, but here it goes
When I select a column from a table, if the column has a null value I
want the select to return me a blank. I have done this before but I
forgot, some one help?
select name, age from people
in the above query the name can be null. I do not want to do
select @name=name....
Thanks. 4 1117
COALESCE(name,'')
--
David Portas
SQL Server MVP
--
"DBC User" <ks*****@yahoo.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com... Hi,
I feel so stupid to ask this question, but here it goes
When I select a column from a table, if the column has a null value I want the select to return me a blank. I have done this before but I forgot, some one help?
select name, age from people
in the above query the name can be null. I do not want to do
select @name=name....
Thanks.
Use the COALESCE function, e.g.,
SELECT COALESCE(name, ' '), age
FROM People
--
JAG
DBC User,
Is this what you mean?
SELECT CASE WHEN [Name] IS NULL THEN '' ELSE [Name] END AS [Name], Age FROM
People
btw, don't use 'Name' as a column name, it is a reserved word in SQL.
-Andy
"DBC User" <ks*****@yahoo.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com... Hi,
I feel so stupid to ask this question, but here it goes
When I select a column from a table, if the column has a null value I want the select to return me a blank. I have done this before but I forgot, some one help?
select name, age from people
in the above query the name can be null. I do not want to do
select @name=name....
Thanks.
Thanks all for the answer. I was looking for COALESCE This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Scott |
last post by:
The following is the XML I have to work with. Below is the question
<Table0>
<CaseID>102114</CaseID>
<CaseNumber>1</CaseNumber>
<DateOpened>2005-06-14T07:26:00.0000000-05:00</DateOpened>...
|
by: calfliu |
last post by:
hello:
everybody! I have a simple question. How can I translate the selected
value
from art to recipient(hidden input button)?
<form name="send" method="post" action="send.cgi">
<select...
|
by: LRW |
last post by:
Having a problem getting a onSubmit function to work, to where it popsup a
confirmation depending on which radiobutton is selected.
Here's what I have:
function checkdel() {
if...
|
by: Stephanie_Stowe |
last post by:
Hi. I am trying to get used to AS.NET. I have been doing ASP classic for
years, and am now in a position to do ASP.NET. I am in the stumbling
around until I get my bearings phase. I hope you will...
|
by: Tim::.. |
last post by:
Can someone tell me how I convert this simple SQL statement so I can use it
in ASP.NET???
I have an issue with the quotation marks and wondered if there is a simple
rule for converting the sql...
|
by: Saber |
last post by:
I did a lot of searches and read something about
datagrids. But I couldn't find the answer of my simple
question, how can I show only my desired columns of
a table? for example I wrote this sql...
|
by: Scott Frankel |
last post by:
Still too new to SQL to have run across this yet ...
How does one return the latest row from a table, given multiple entries
of varying data?
i.e.: given a table that looks like this:
color...
|
by: dba_222 |
last post by:
Dear Experts,
Ok, I hate to ask such a seemingly dumb question, but I've
already spent far too much time on this. More that I
would care to admit.
In Sql server, how do I simply change a...
|
by: Chrism2671 |
last post by:
I'm new to XSLT/XML and I have a very simple, quick question. i've
been trying to convert simple xml files into CSV files and have made a
simple XSLT template using the w3 tutorials, but it doesn't...
|
by: muddasirmunir |
last post by:
i have a simple query and does not getting desire results which i want
i am using vb6 and access
i had a table with with 8 fields but just to simplyfy by question i am just
supposing to four.
...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |