locked
Auto Generate GUIDs for Content types RRS feed

  • General discussion

  • Would like to share a logic to auto generate GUIDs for custom lists and Custom Content Types through SQL



     ---author: Sudhakar Roy Chinasumala

    --- email csroy@yahoo.com

    -- Function: Auto generate GUIDs

    DECLARE @iGuidCount INT;
    DECLARE @check BIT;
    DECLARE @sGuids VARCHAR(8000)='';
    SET @check=0;
    SET @iGuidCount=0;

    WHILE @check = 0
    BEGIN
        SET @sGuids+='{'+ CONVERT(VARCHAR(100),NEWID())+'}' + CHAR(10)
    SET @iGuidCount +=1;
    IF  @iGuidCount=10   --enter number to generate GUIDs...run this in sql promot...log on to any sql server
        SET @check=1;
    END
    PRINT @sGuids;

    --------------------------------------------------------------------------------------

    OUTPUT:

    {EB2CC7D6-290E-4787-A5FB-43C715F00352}
    {664B8F46-39C5-494C-98FE-AEBE604A4A6B}
    {B695E52E-5736-46D1-8EA5-070E66FF5536}
    {85296807-97FD-4190-B41E-D0EFE9F9456D}
    {3DC88527-4B82-4B77-AE30-EDEB9D229C74}



    Wednesday, June 13, 2012 6:20 PM