• I've done quite a bit of testing of NEWID() and randomness and it is a very effective random number generator.

    As the GUID comprises of blocks of hexadecimal these blocks can be converted into integer values.

    I took a customer file where the PK was a GUID and based a partitioning scheme on a converted integer value and modulo 16 and it ended up with near ideal partition distribution.

    Try the following

    DECLARE

    @test-2 char(4),

    @MyInt INT,

    @SQL NVARCHAR(200),

    @ParmDefinition NVARCHAR(200)

    SET @test-2=LEFT(NEWID(),4)

    SET @SQL='SET @MyInt=CONVERT(INT,0x'+@Test+')'

    SET @ParmDefinition=N'@MyInt int OUTPUT'

    EXEC sp_Executesql

    @SQL,

    @ParmDefinition,

    @MyInt = @MyInt OUTPUT

    SELECT @test-2,@MyInt