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 |
|
littlewing
Starting Member
33 Posts |
Posted - 2008-03-20 : 11:19:22
|
| Can someone help me with the following? I need to update all columns in a table where the value is zero with NULL where the row id's (primary keys) are between two values. I was hoping that I could do this without "hard coding" the column names as there are many columns. i.e:UPDATE TABLENAMEFOR ALL COLUMNS SET VALUE = NULL WHERE VALUE = 0FOR ROWS BETWEEN n and mThanks! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-20 : 11:24:06
|
| UPDATE TABLENAMESET Field1 = NULLIF(Field1,0),Field2=NULLIF(Field2,0),... WHERE PK BETWEEN n and m |
 |
|
|
|
|
|