nathanharcup
MIS
Hi All,
I am having an issue at the moment where I need to generate a random guid (uniqueidentifier) within a table when a row is inserted.
I am after some clarity that the quickest way to atchive this would be to drop the column and re-add it using;
CREATE TABLE MyUniqueTable
(UniqueColumn UNIQUEIDENTIFIER DEFAULT NEWID(),
Characters VARCHAR(10) )
GO
would the insert statment need to use newid() ?
Is there a way I can implement a trigger after insert to generate this value (if it has not already been generated)?
Thanks
Nathan
I am having an issue at the moment where I need to generate a random guid (uniqueidentifier) within a table when a row is inserted.
I am after some clarity that the quickest way to atchive this would be to drop the column and re-add it using;
CREATE TABLE MyUniqueTable
(UniqueColumn UNIQUEIDENTIFIER DEFAULT NEWID(),
Characters VARCHAR(10) )
GO
would the insert statment need to use newid() ?
Is there a way I can implement a trigger after insert to generate this value (if it has not already been generated)?
Thanks
Nathan