newid() will definately work. But will also create "fragmented" values.
This may be beneficial or detrimental (think guid as a Primary Key) to your needs.
Here is a procedure I wrote a while back to "kinda help" with fragmentation.
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[uspNewSequentialUUIDCreateSingle]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[uspNewSequentialUUIDCreateSingle]
GO
/*
--START TEST
declare @returnCode int
declare @ReturnUUID uniqueidentifier
EXEC @returnCode = dbo.uspNewSequentialUUIDCreateSingle @ReturnUUID output
print @ReturnUUID
print '/@returnCode/'
print @returnCode
--loop test,,,loop exists for TESTING only fyi
declare @counter int
select @counter = 1000
while @counter > 0
begin
EXEC @returnCode = dbo.uspNewSequentialUUIDCreateSingle @ReturnUUID output
print @ReturnUUID
select @counter = @counter - 1
end
--END TEST CODE
*/
CREATE PROCEDURE [dbo].[uspNewSequentialUUIDCreateSingle] (
@ReturnUUID uniqueidentifier output --return
)
AS
--//You can use NEWSEQUENTIALID() to generate GUIDs to reduce page contention at the leaf level of indexes.
SET NOCOUNT ON
-- declare @ReturnUUID uniqueidentifier
declare @t table ( id int , uuid uniqueidentifier default newsequentialid() )
insert into @t ( id ) values (0)
select @ReturnUUID = uuid from @t
SET NOCOUNT OFF
GO
GRANT EXECUTE ON dbo.uspNewSequentialUUIDCreateSingle TO public
GO