473,545 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change cell values from NULL to BLANK?

In the result of a SELECT statement, how can you change cell values
from NULL to BLANK?
The following does NOT do it:

SET fieldname = ' '
WHERE fieldname IS NULL

Also, for colums with a DATE data type, I want to change 0000-00-00 to
BLANK.
For for colums with a numeric data type such as DOUBLE, I want to
change 00.00 to BLANK.

Again, the above doesn't work. How can I blank those fields?
Jul 20 '05 #1
1 10099
Scott wrote:
In the result of a SELECT statement, how can you change cell values
from NULL to BLANK?
The following does NOT do it:

SET fieldname = ' '
WHERE fieldname IS NULL
That syntax is for the UPDATE statement, not the SELECT statement. Do
you want to change the values as they are stored in the database, or do
you want to change them dynamically only when you do a SELECT?

Here's the solution for both cases:

UPDATE myTable SET fieldname = ' ' WHERE fieldname IS NULL;

SELECT COALESCE(fieldn ame, ' ') FROM myTable;
Also, for colums with a DATE data type, I want to change 0000-00-00 to
BLANK.
For for colums with a numeric data type such as DOUBLE, I want to
change 00.00 to BLANK.


A blank is not a legal value to store in date and numeric columns. You
can change them to store a NULL state:

UPDATE myTable SET myDateField = NULL WHERE myDateField = '0000-00-00';
UPDATE myTable SET myNumField = NULL WHERE myNumField = '0.0';

Then you can use something like the SELECT COALESCE... example above.

Bill K.
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1827
by: Scott | last post by:
In the result of a SELECT statement, how can you change cell values from NULL to BLANK? The following does NOT do it: SET fieldname = ' ' WHERE fieldname IS NULL Also, for colums with a DATE data type, I want to change 0000-00-00 to BLANK. For for colums with a numeric data type such as DOUBLE, I want to
12
2161
by: adrianca | last post by:
Hi All, If have a sql table with 2 columns and 2 rows with values ,]. Using t-SQL with "for xml" How can i create a xml where the cell values (not column names) appear as elements? eg: <col1row1>col2row1</col1row1> <col1row2>col2row2</col1row2>
1
1994
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title: Developer Address: 123 Main Street. After the table of information will be the web form. So basically I want to display the table and then have the web...
2
2350
by: Richard Dixson | last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit questions. This page will consist of a table with several rows of information, like: Name: Bill Smith Job title: Developer Address: 123 Main Street. After the table of information will be the web form. So basically I want to display the table and then have the web...
1
1330
by: jeganwaran | last post by:
retrieve cell values from the grid view using code
4
1797
by: Techhead | last post by:
I am running into an issue when adding data from multiple columns into one alias: P.ADDR1 + ' - ' + P.CITY + ',' + ' ' + P.STATE AS LOCATION If one of the 3 values is blank, the value LOCATION becomes NULL. How can I inlcude any of the 3 values without LOCATION becoming NULL? Example, if ADDR1 and CITY have values but STATE is blank, I...
0
2167
by: RKT | last post by:
I have a DataGridView bound to an MS Access table. This is a single- user application. When the User is adding or editing a row, the User may click on a Control elsewhere. That Control has context which I use to programmatically set *other* r/o cell values for the currently selected grid row. So, after that click on another control, and...
1
12400
by: silentbuddha | last post by:
Hi, I am currently having some difficulties with this sunroutine that I created. My 2 dimensional array is empty. - This code is within my UserForm1 - this sub is suppose to first select the WorkSheets("English"). The sheet contains col A, col B & col C. The sub will goto each row, if there is a cell value that matches the search criteria...
1
12298
by: jrlittle86 | last post by:
I know I'm overlooking something very simple but How can I check if the text within an XML tag is blank? The code below works fine as long as there are values within an XML node (For example the <CPU>Intel</CPU> node below) but it throws an Exception error when the node value is blank/null whatever as in the example node <Monitor> ...
0
7420
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7680
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7934
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7446
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
731
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.