Add primary Key as GUID automatic generation
-
I have Some table in database (Access, SQLServer and Oracle) haven' t Primary Key.Client need to do a replication for this database. I ask how do the update script for one table to add primary key as GUID automatic (it means when I add a record as before there is no need to edit source code) I did this for SQLServer and it works but for Access and Oracle no idea how to do this :( example :
create table [SAC_MEMBERSHIPS](
id_group nvarchar(40) FOREIGN KEY REFERENCES SAC_SUBJECTS(id_subject),
id_user nvarchar(40) FOREIGN KEY REFERENCES SAC_SUBJECTS(id_subject),
id_memberships UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY
)/ALTER TABLE [SAC_MEMBERSHIPS]
ADD [id_memberships] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY
ON [PRIMARY]
/ -
I have Some table in database (Access, SQLServer and Oracle) haven' t Primary Key.Client need to do a replication for this database. I ask how do the update script for one table to add primary key as GUID automatic (it means when I add a record as before there is no need to edit source code) I did this for SQLServer and it works but for Access and Oracle no idea how to do this :( example :
create table [SAC_MEMBERSHIPS](
id_group nvarchar(40) FOREIGN KEY REFERENCES SAC_SUBJECTS(id_subject),
id_user nvarchar(40) FOREIGN KEY REFERENCES SAC_SUBJECTS(id_subject),
id_memberships UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY
)/ALTER TABLE [SAC_MEMBERSHIPS]
ADD [id_memberships] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY
ON [PRIMARY]
/create table [table] (
id raw(32) default sys_guid(),
...,
constraint pk_id primary key (id)
);I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
create table [table] (
id raw(32) default sys_guid(),
...,
constraint pk_id primary key (id)
);I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
I don't know him!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
I don't know him!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
Please do not use rude words here...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
Please do not use rude words here...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
The only mistake you did that you didn't realized the joke icon :laugh:
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
I have Some table in database (Access, SQLServer and Oracle) haven' t Primary Key.Client need to do a replication for this database. I ask how do the update script for one table to add primary key as GUID automatic (it means when I add a record as before there is no need to edit source code) I did this for SQLServer and it works but for Access and Oracle no idea how to do this :( example :
create table [SAC_MEMBERSHIPS](
id_group nvarchar(40) FOREIGN KEY REFERENCES SAC_SUBJECTS(id_subject),
id_user nvarchar(40) FOREIGN KEY REFERENCES SAC_SUBJECTS(id_subject),
id_memberships UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY
)/ALTER TABLE [SAC_MEMBERSHIPS]
ADD [id_memberships] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY
ON [PRIMARY]
/ -
I have Some table in database (Access, SQLServer and Oracle) haven' t Primary Key.Client need to do a replication for this database. I ask how do the update script for one table to add primary key as GUID automatic (it means when I add a record as before there is no need to edit source code) I did this for SQLServer and it works but for Access and Oracle no idea how to do this :( example :
create table [SAC_MEMBERSHIPS](
id_group nvarchar(40) FOREIGN KEY REFERENCES SAC_SUBJECTS(id_subject),
id_user nvarchar(40) FOREIGN KEY REFERENCES SAC_SUBJECTS(id_subject),
id_memberships UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY
)/ALTER TABLE [SAC_MEMBERSHIPS]
ADD [id_memberships] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWSEQUENTIALID() PRIMARY KEY
ON [PRIMARY]
/Also Access has a Guid datatype.
CREATE TABLE [SAC_MEMBERSHIPS]
(
[id_memberships] GUID NOT NULL PRIMARY KEY,
... -
Also Access has a Guid datatype.
CREATE TABLE [SAC_MEMBERSHIPS]
(
[id_memberships] GUID NOT NULL PRIMARY KEY,
...