wassim-azirar wassim-azirar - 1 year ago 79
SQL Question

Insert statement when having GUID as primary key

Is there a way to insert a row in SQL CE using the INSERT Statement when I have a GUID field.

In C#, I use

ID = Guid.NewGuid()

But in SQL console I can't find a keyword to do this.

I've found just this one :

> Insert into Customer (ID, Name) values ('f5c7181e-e117-4a98-bc06-733638a3a264','MyCustomer')

What about if I have a lot of rows to insert ?

Answer Source

try to use Newid() in Sql server to generate GUID

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download