Mike,
Thanks for actually reading my post.
Yeah, I don't see a way to do it with System.Guid. ( I was already aware of
that class' existence ).
I may use my usp and push some sequential guid's up to the business layer,
since I'll already be in the database.
Or delay their creation until I'm pushing some data back into the tsql.
Oh well, I thought I'd ask.
"Family Tree Mike" <(E-Mail Removed)> wrote in
message news:764F289D-3021-4CFC-B53B-(E-Mail Removed)...
>I don't see a way to do this with the System.Guid class. newsequentialid
>was
> introduced to provide some optimization in SQL, but that was not part of
> the
> intent of GUIDs. GUIDs are somewhat random, and newsequentialid does away
> with the randomness.
>
>
> "sloan" wrote:
>
>> Current Framework 2.0/3.0.
>>
>> ...
>>
>> In Sql Server, there is a way to generate consecutive guid's.
>> newsequentialid.
>>
>> Is there a way to reproduce this type of consecutive guid's in the
>> framework.
>>
>> I found some info about uuidgen , but that seems like a command line
>> prompt
>> tool, not a class library.
>>
>> I'd like to be able to throw an int value (N) at it, and it return N
>> consecutive guid's.
>>
>>
>> .........
>>
>>
>> Here is a test stored procedure I wrote to show you what I'm talking
>> about.
>>
>>
>>
>>
>>
>>
>>
>>
>> IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
>> OBJECT_ID(N'[dbo].[uspNewSequentialUUIDCreateRange]') AND type in (N'P',
>> N'PC'))
>>
>> DROP PROCEDURE [dbo].[uspNewSequentialUUIDCreateRange]
>>
>> GO
>>
>>
>>
>> CREATE PROCEDURE [dbo].[uspNewSequentialUUIDCreateRange] (
>>
>> @newUUIDCount int --return
>>
>> )
>>
>> AS
>>
>> SET NOCOUNT ON
>>
>> declare @t table ( dummyid int , entryid int identity(1,1) , uuid
>> uniqueidentifier default newsequentialid() )
>>
>> insert into @t ( dummyid ) select top (@newUUIDCount) 0 from
>> dbo.sysobjects
>> so with (nolock)
>>
>> select entryid , uuid from @t
>>
>> SET NOCOUNT OFF
>>
>> GO
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> /*
>>
>> --START TEST
>>
>> set nocount ON
>>
>> Create Table #HolderTable (entryid int , uuid uniqueidentifier )
>>
>> declare @NewUUIDCount int
>>
>> select @NewUUIDCount = 20
>>
>> INSERT INTO #HolderTable EXEC dbo.uspNewSequentialUUIDCreateRange
>> @NewUUIDCount
>>
>>
>>
>> select * from #HolderTable
>>
>>
>>
>> DROP Table #HolderTable
>>
>> --END TEST CODE
>>
>>
>>
>> */
>>
>>
>>
|