/* SmallDateTime kan gemme datoer fra 01-01-1900 til 06-06-2079. Typen kræver 4 bytes i databasen, hvorimod DateTime kræver 8 bytes. */


DECLARE @XType INT
SELECT @XType = SysTypes.XType
FROM SysColumns WITH (NOLOCK)
  INNER JOIN
  SysTypes ON SysColumns.XType = SysTypes.XType
WHERE (SysColumns.ID IN
        (SELECT [ID]
         FROM   SysObjects WITH (NOLOCK)
         WHERE  Name = 'Reservations')) AND (SysColumns.Name = 'ExpireDate')

IF @XType = 61 -- DateTime
  update reservations set [expiredate]=null where [expiredate] < '19800101' OR [expiredate] > '20790606'
