SQL Server syntax for NEWID()

635 views Asked by At

I need some help with some SQL Server 2014 syntax.

I want to use the NEWID() function to create the UUID value in column CareplannersUUID. Each time a record is inserted, I want a new UUID value to appear in column CareplannersUUID.

But I am not sure about the syntax of the command. I think it is something like:

ALTER TABLE CareplannersMembers 
    ADD CONSTRAINT DF_table_id DEFAULT (NEWID()) FOR CareplannersUUID

I am wondering specifically, is there another value I should add for DF_table_id?

Notes about the table in question:

  • Table name: CareplannersMembers
  • UUID column name: CareplannersUUID

Thank you for your help.

Eric

I looked at the similar questions, but am not able to determine, from information presented there, whether or not I am using the correct syntax for my SQL Server statement.

0

There are 0 answers