Updating ID field

  • Hi,

    I have a table:

    CREATE TABLE [dbo].[FIM_GLOBAL_ID](

    [GlobalID] AS ('RH'+right(''+CONVERT([varchar],[ID]),(10))),

    [ID] [int] IDENTITY(100100,1) NOT NULL,

    [FirstName] [varchar](50) NULL,

    [LastName] [nvarchar](50) NULL,

    [PreferredName] [varchar](50) NULL,

    [DisplayName] [varchar](50) NULL,

    [DateofBirth] [varchar](20) NULL,

    [Company] [varchar](50) NULL,

    [AccountName] [varchar](50) NULL,

    [nvarchar](50) NULL,

    [MVObjectID] [uniqueidentifier] NULL

    ) ON [PRIMARY]

    Data is as follows:

    GlobalIDIDFirstNameLastNamePreferredNameDisplayNameDateofBirthCompanyAccountNameemailMVObjectID

    RH100100100100TomCarsTomTom Cars1980-06-05Roy Pty LtdNULLNULL04165B39-7238-E311-9426-0050568579DE

    RH100101100101PaulColePaulPaul Cole1980-03-01Roy Pty Ltdpaul.coleNULL42A9E51C-1D1C-E311-9422-0050568579DE

    RH100102100102TerrenceQuaifeTerryTerry Quaife1956-10-07Holdings Pty LtdTerry.Quaifeterry.quaife@none.com.au049FC5BC-9613-E311-9422-0050568579DE

    The design was such that I would be able to start the GlobalID from a specific point - which I now have found out is due to execs wanting to reserve the first 100 for them.

    ie anything below RH100100.

    Now they want to add them in or alter their GlobalID to reflect this.

    Am I able to or is there a way in which I can alter the first row to read

    GlobalIDIDFirstNameLastNamePreferredNameDisplayNameDateofBirthCompanyAccountNameemailMVObjectID

    RH100001100001TomCarsTomTom Cars1980-06-05Roy Pty LtdNULLNULL04165B39-7238-E311-9426-0050568579DE

    or

    GlobalIDIDFirstNameLastNamePreferredNameDisplayNameDateofBirthCompanyAccountNameemailMVObjectID

    RH100000100100TomCarsTomTom Cars1980-06-05Roy Pty LtdNULLNULL04165B39-7238-E311-9426-0050568579DE

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • Solution found -

    SET IDENTITY_INSERT [FIM_GLOBAL_ID] OFF

    drop the row I want to change the ID on and then re insert it with the new ID

    SET IDENTITY_INSERT dbo.[FIM_GLOBAL_ID] ON

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

Viewing 2 posts - 1 through 1 (of 1 total)

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