Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2008-10-10 : 09:26:09
|
| I have a table with a column 'DebtTypeCode' of type varchar(8)Currently this column is null for all rows. I wish to make it an empty string. But usingUSE debtUPDATE table DebtSET DebtTypeCode = ""WHERE DebtTypeCode ISNULLleaves the column as null for all rows.Where am I going wrong please? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-10 : 09:30:00
|
quote: Originally posted by OldMySQLUser I have a table with a column 'DebtTypeCode' of type varchar(8)Currently this column is null for all rows. I wish to make it an empty string. But usingUSE debtUPDATE table DebtSET DebtTypeCode = ""WHERE DebtTypeCode IS NULL leaves the column as null for all rows.Where am I going wrong please?
use IS NULL instead of ISNULL.IS NULL does comaprison with NULL values while ISNULL() functions replaces NULLs with specified value. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-10 : 10:53:12
|
quote: Originally posted by OldMySQLUser I have a table with a column 'DebtTypeCode' of type varchar(8)Currently this column is null for all rows. I wish to make it an empty string. But usingUSE debtUPDATE table DebtSET DebtTypeCode = ""WHERE DebtTypeCode ISNULLleaves the column as null for all rows.Where am I going wrong please?
Where did you execute the code?If you executed in QA, you would have got errorMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|