How to generate and manually insert a uniqueidentifier in sql server?

后端 未结 2 1253
南旧
南旧 2021-02-05 02:51

I\'m trying to manually create a new user in my table but impossible to generate a \"UniqueIdentifier\" type without threw an exception ...

Here is my example:



        
2条回答
  •  太阳男子
    2021-02-05 03:20

    Kindly check Column ApplicationId datatype in Table aspnet_Users , ApplicationId column datatype should be uniqueidentifier .

    *Your parameter order is passed wrongly , Parameter @id should be passed as first argument, but in your script it is placed in second argument..*

    So error is raised..

    Please refere sample script:

    DECLARE @id uniqueidentifier
    SET @id = NEWID()
    Create Table #temp1(AppId uniqueidentifier)
    
    insert into #temp1 values(@id)
    
    Select * from #temp1
    
    Drop Table #temp1
    

提交回复
热议问题