• Thankyou very much for your help, that works now.

    One last thing if i may:

    How would i add this function into the procedure?

    It changes the yob to always have a day, or month and day when used. I usually call it once i've imported the table. However now we have this statement to check if null, id like to add this in too.

    Many thanks again!

    R

    USE [TestDB]

    GO

    /****** Object: UserDefinedFunction [dbo].[fixDate] Script Date: 08/23/2011 13:50:17 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER function [dbo].[fixDate](@dateIn char(8))

    returns char(8)

    as

    begin

    declare @out char(8)

    if substring(@dateIn, 7,2) = '00'

    if substring(@dateIn, 5,2) = '00'

    set @out = left(@dateIn,4) + '0701'

    else

    set @out = left(@dateIn,6) + '15'

    else set @out = @dateIn

    return @out

    end