• dave-L (11/21/2012)


    Thanks for your help opc.three.

    One last thing: I hate to leave less than optimal code out there for posterity so here is my last, optimized function with all string manipulation removed 🙂

    CREATE FUNCTION makeGUID

    (

    @GUID AS UNIQUEIDENTIFIER,

    @number AS BIGINT

    )

    RETURNS UNIQUEIDENTIFIER

    AS

    BEGIN

    RETURN CAST(CAST(@guid AS BINARY(10)) + CAST(@Number AS BINARY(6)) AS UNIQUEIDENTIFIER)

    END

    GO

    One query on that: is @GUID providing the randomness while number is just a counter? If so, I don't understand why you have them in that order in the returned value.

    Tom