Create unique user name from first and last name

  • Does anyone have a function or stored procedure to create a unique user name from first and last name?  I would appreciate the help.

     

    Thanks

  • Would this work?

    USE Northwind

    select LastName + FirstName +

    CONVERT(varchar(2),(DATEPART(mm,GETDATE()))) +

    CONVERT(varchar(2),(DATEPART(dd,GETDATE()))) +

    CONVERT(varchar(4),(DATEPART(yy,GETDATE()))) +

    CONVERT(varchar(2),(DATEPART(hh,GETDATE()))) +

    CONVERT(varchar(2),(DATEPART(mi,GETDATE()))) +

    CONVERT(varchar(2),(DATEPART(ss,GETDATE()))) +

    CONVERT(varchar(4),(DATEPART(ms,GETDATE())))

    AS UID

    from Employees



    Everett Wilson
    ewilson10@yahoo.com

  • Elaborating...

    USE Northwind

    select LastName + FirstName + convert(varchar(36),newid()) from Employees -- Very Unique

    select binary_checksum(LastName,FirstName) from Employees-- Case sensitive

    select checksum(LastName,FirstName) from Employees-- Case insensitive

    /rockmoose


    You must unlearn what You have learnt

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply