Home > Mobile >  ACCDB database, update GUID column
ACCDB database, update GUID column

Time:10-18

I have an Access database that need to be upgraded to using GUIDs. I added a number column with replication ID size one of the base table and now I need to add the GUIDs for each of the rows.

I'm writing in C#. Looping through all the records in the data, I'm trying to do a SQL update statement, and I can't get the syntax right.

Currently I have this;

UPDATE Locations 
SET LocationGUI = '{0027033a-7d16-485b-a76d-1c767c3ef030}', 
    Facility = '', 
    Address1 = '', Address2 = '', 
    City = '', State = '', Zip = '', 
    Telephone = '', Fax = '', Website = '' 
WHERE LocationID = 1;

But that's not right. What is the correct syntax around the GUID I'm trying to update into the table?

CodePudding user response:

Try this - without the typo and leaving the other fields untouched:

UPDATE Locations 
SET LocationGUID = '{0027033a-7d16-485b-a76d-1c767c3ef030}'
WHERE LocationID = 1;
  • Related