Home Forums SQL Server 2008 T-SQL (SS2K8) Always set a Field to NULL - is a trigger the answer RE: Always set a Field to NULL - is a trigger the answer

  • Thanks for replying

    dwain.c I hadn't thought of that

    Jeff There are no pre-existing triggers.

    I tried the periodical job but it takes ages to run. I'd expected first time to run to take ages as many rows had non blank column values. I suspect even the second run would take a long time: The columns are not part of an index and some of the columns are TEXT datatype

    and default to '' which I can leave in.

    so

    UPDATE tbl###

    SET Fld1= NULL, Fld2=NULL, Fld3=NULL

    WHERE Fld1 IS NOT NULL OR Fld2 IS NOT NULL OR datalength(Fld3) <> 0

    I use

    datalength(Fld3) <> 0

    because I don't mind if the TEXT field Fld3 = ''.