2012-12-10 41 views
5

SSDT功能的一部分是通過臨時缺省約束(稱爲「智能默認設置」)使用虛擬值填充不可爲空列的功能。按類型劃分的SSDT「智能默認值」

每試驗和錯誤,我發現下面的「智能默認」值:

--------------------------------------------------------------- 
| Type    | Smart Default Value      | 
--------------------------------------------------------------- 
| int    | 0          | 
--------------------------------------------------------------- 
| uniqueidentifier | 00000000-0000-0000-0000-000000000000  | 
--------------------------------------------------------------- 
| "string"   | ''          | 
--------------------------------------------------------------- 

有誰知道是否存在每種類型的「智能默認」值的資源?

回答

9

我找不到官方文檔。我列出了一個基於SSDT實驗的列表,併發布在SSDT Default Values For Smart Defaults,但它包含在下面供快速參考。 (對不起 - 我可以使用格式化)。

bigint    0 
binary    0x00 
bit     0 
char    empty string 
date    1900-01-01 
datetime   1900-01-01 00:00:00.000 
datetime2   1900-01-01 00:00:00.0000000 
datetimeoffset  1900-01-01 00:00:00.0000000 +00:00 
decimal    0 
float    0 
hierarchyid   smart default not valid 
image    0x 
int     0 
money    0.00 
nchar    empty string 
ntext    empty string 
numeric    0 
nvarchar   empty string 
real    0 
smalldatetime  1900-01-01 00:00:00 
smallint   0 
smallmoney   0.00 
sql_variant   smart default not valid 
text    empty string 
time    00:00:00.0000000 
timestamp   null value not allowed 
tinyint    0 
uniqueidentifier 00000000-0000-0000-0000-000000000000 
varbinary   0x 
varchar    empty string 
xml     empty string