• You can try this:declare @timevar int

    select @timevar = '145345'

    select right('000000' + cast(@timevar as varchar(6)), 6)

    select @timevar = '23'

    select right('000000' + cast(@timevar as varchar(6)), 6)



    Microsoft Certified Master - SQL Server 2008
    Follow me on twitter: @keith_tate

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]