#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2011
    Posts
    4
    Rep Power
    0

    Change value from zero to NULL


    Hello,

    When I import data from a .csv-file, MS SQL Server 2008 gives the value "0" if there is no value at all for a particular date. I want to have NULL as a value instead in these cases.

    How would I go about if I wanted to change the value "0" to "NULL" in a column in one of my tables?

    /lampis
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,027
    Rep Power
    4210
    Code:
    UPDATE daTable
       SET somecolumn = NULL
     WHERE somecolumn = 0
    r937.com | rudy.ca
    please visit Simply SQL and buy my book

IMN logo majestic logo threadwatch logo seochat tools logo