newid() and newsequentialid()

  • Comments posted to this topic are about the item newid() and newsequentialid()

  • At the very least, they are spelled differently. 😎

  • As for newsequentialid() not being able to be referenced directly, here's a kluge I've been using (not my idea, but liked it's simplicity):

    -- default to one value returned

    create proc get_newsequentialid

    @numID int = 1

    as

    begin

    create table #my_seq_id(myID uniqueidentifier default newsequentialid())

    declare @cnt int

    set @cnt = 0

    while @cnt < @numID

    begin

    insert into #my_seq_id default values

    set @cnt = @cnt + 1

    end

    select * from #my_seq_id

    drop table #my_seq_id

    end

    go

    Gaby________________________________________________________________"In theory, theory and practice are the same. In practice, they are not." - Albert Einstein

  • Inasmuch as they both generate GUIDs, they are the same. The question was somewhat ambiguous

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

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