How to create table with UNIQUEIDENTIFIER as primary key

1,022 views
Skip to first unread message

Michael Powell

unread,
Sep 6, 2014, 2:20:24 PM9/6/14
to fluentmigrato...@googlegroups.com
Hello,

I am using SQL Server 2012, and I want to create a table with Guid as the primary key.

Mostly, table creation itself seems to work, but how might I instruct the fluent bits to do things like provide "newid()" for Default Value or Binding, potentially Row GUID Column (if necessary), and things such as this.

Thank you...

Best regards,

Michael Powell

Tom Marien

unread,
Sep 16, 2014, 3:03:51 PM9/16/14
to fluentmigrato...@googlegroups.com
Hi Michael

How about this

Create.Table(TableName).InSchema(SchemaName)
                .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid);

Hope it helps

Kr

Reply all
Reply to author
Forward
0 new messages