• It's not a code problem, it's database corruption. Since it's in TempDB, you should be able to fix it by restarting the SQL service. That will cause TempDB to be recreated. There's no actual fix for this kind of corruption that I know of.

    Just to be sure, can you run this on the model database please?

    DBCC CHECKDB (< Database Name > ) WITH NO_INFOMSGS, ALL_ERRORMSGS

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass