How to generate a new Guid in stored procedure?

前端 未结 5 810
时光说笑
时光说笑 2021-02-03 16:16

I currently have a stored procedure in which I want to insert new rows into a table.

insert into cars
(id, Make, Model)
v         


        
5条回答
  •  庸人自扰
    2021-02-03 17:10

    With SQL Server you can use the function NEWID. You're using C# so I assume that you're using SQL Server. I'm sure other database system have similar functions.

    select NEWID()
    

    If you're using Oracle then you can use the SYS_GUID() function. Check out the answer to this question: Generate a GUID in Oracle

提交回复
热议问题