• Hi, You probably don't want to go there as far as creating a custom key. Anyway you haven't convinced me that this is really necessary so I would try to use the standard functionality so you don't get off on the wrong foot. 😉

    DROP TABLE Test

    CREATE TABLE [dbo].[Test](

    [MyDate] [datetime] NULL

    ) ON [PRIMARY]

    INSERT INTO Test

    SELECT '1/1/2011 3:00:00 PM' UNION

    SELECT '1/1/2011 4:00:00 PM' UNION

    SELECT '1/1/2011 5:00:00 PM' UNION

    SELECT '1/2/2011 5:00:00 PM' UNION

    SELECT '1/2/2011 5:10:00 PM'

    SELECT * FROM Test

    You should be able to use a CTE to generate a sequential number

    SELECT

    'AL ' + REPLACE(CONVERT(VARCHAR(10), MyDate, 101), '/', '') + '-' +

    --here you would add the code that would resequence for each new date

    --since I am not too good with this I am hoping someone smarter than me will fill in the blanks here

    FROM Test

    This assumes you don't need to store this pseudo-key, just present it.