Let's take a look at the create table section of msdn. It's a long line of content that people don't know. It's a headache for me. The SQL script generated using SSMs is certainly functional, but it is always uncomfortable in terms of appearance. In addition, the scripts generated by SSMs, including foreign keys and constraints, are added by means of modification, and several lines are added for no reason.CodeIn fact, all the content is a create table.
If Object_id ( ' Users ' , ' U ' ) Is Not Null Drop Table Users
Create Table Users
(
Userid Uniqueidentifier Not Null
Primary Key Clustered (Userid ASC )
Default Newid (),
Applicationid Uniqueidentifier Not Null
References Applications (applicationid ),
Email Varchar ( 255 ) Not Null
Unique Nonclustered (Applicationid ASC , Email ASC ),
Description Nvarchar ( 255 ) Null
)
This section contains some basic information, including: primary key, foreign key, clustered index, non-clustered index, non-null, allowed null, and default value. Both clustered indexes and non-clustered indexes allow multiple entries separated by commas. The drop statement contained in the SSMs generation script is too coorse, which is more concise and has the same functions.