Advertisement

10.24.2005 at 06:06AM PDT, ID: 21605329
[x]
Attachment Details

How to replace null values with zeros in a SQL table

Asked by novice12 in MS SQL Server

Tags: null, replace, sql, values, zero

I have a SQL table, and I am using T-SQL. I have one table with some null values in one of the columns. I want to replace the null values with zeros. I am using this query:

Use Energy_Db
Update DataCenter_Amps
Set PDU_Max_KW = 0
Where PDU_Max_KW = null

The problem is that when I run the query, no change takes place ( 0 rows are affected). How can I make this work?

ThanksStart Free Trial
[+][-]10.24.2005 at 06:08AM PDT, ID: 15146153

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: null, replace, sql, values, zero
Sign Up Now!
Solution Provided By: flavo
Participating Experts: 3
Solution Grade: A
 
 
[+][-]10.24.2005 at 06:15AM PDT, ID: 15146216

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.24.2005 at 06:16AM PDT, ID: 15146219

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.24.2005 at 06:22AM PDT, ID: 15146252

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.24.2005 at 08:01AM PDT, ID: 15147067

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32