How to Turn Rowguid option on via SQL Query?

How do I turn Rowguid option on (= Yes), when I create a table via SQL Query?

(See SQL Server Management Studio, Column properities , Rowguid by default is no).


Test Query Attached.
create table TableA (TableAID int identity not null, Name nvarchar(50) not null, rowguid uniqueidentifier default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, TableBID int null, constraint PK_TableA primary key (TableAID));
create table TableB (TableBID int identity not null, Name nvarchar(50) not null, rowguid uniqueidentifier default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, constraint PK_TableB primary key (TableBID));
create table TableA2 (TableA2ID int identity not null, Name nvarchar(50) not null, rowguid uniqueidentifier default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, TableBID int null, constraint PK_TableA2 primary key (TableA2ID));
create table TableB2 (TableB2ID int identity not null, Name nvarchar(50) not null, rowguid uniqueidentifier default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, constraint PK_TableB2 primary key (TableB2ID));
create table TableA3 (TableA3ID int identity not null, Name nvarchar(50) not null, rowguid uniqueidentifier default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, TableB3ID int null, constraint PK_TableA3 primary key (TableA3ID));
create table TableB3 (TableB3ID int identity not null, Name nvarchar(50) not null, rowguid uniqueidentifier default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, constraint PK_TableB3 primary key (TableB3ID));
create table TableA4 (TableA4ID int identity not null, Name nvarchar(50) not null, rowguid uniqueidentifier default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, constraint PK_TableA4 primary key (TableA4ID));
create table TableB4 (TableB4ID int identity not null, Name varchar(50) null, rowguid uniqueidentifier default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, constraint PK_TableB4 primary key (TableB4ID));
create table TableA4_TableB4 (TableA4ID int not null, TableB4ID int not null, primary key (TableA4ID, TableB4ID));
alter table TableA add constraint FKTableA_TableB foreign key (TableBID) references TableB;
alter table TableA2 add constraint FKTableA2_TableB2 foreign key (TableBID) references TableB2;
alter table TableA3 add constraint FKTableA3_TableB3 foreign key (TableB3ID) references TableB3;
alter table TableA4_TableB4 add constraint FKTableA4TableB4_TableA4 foreign key (TableA4ID) references TableA4;
alter table TableA4_TableB4 add constraint FKTableA4TableB4_TableB4 foreign key (TableB4ID) references TableB4;

Open in new window

KhouAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dportasCommented:
ROWGUIDCOL:

create table TableA (TableAID int identity not null, Name nvarchar(50) not null, rowguid uniqueidentifier ROWGUIDCOL default (newid()) not null unique, ModifiedDate datetime default (getdate()) not null, TableBID int null, constraint PK_TableA primary key (TableAID));
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KhouAuthor Commented:
Thanks Dportas
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.