Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSDT "Smart Defaults" Values By Type

Part of the SSDT functionality is the ability to fill in non-nullable columns with dummy values via a temporary, default constraint (termed "smart defaults").

Per trial and error, I have discovered the following "smart default" values:

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

Does anyone know if there exists a resource of the "smart default" values per type?

like image 860
TMcManemy Avatar asked Dec 10 '12 19:12

TMcManemy


1 Answers

I couldn't find official documentation either. I put together a list based on experimenting with SSDT and published it at SSDT Default Values For Smart Defaults but it's included below for quick reference. (sorry- best I could do with formatting).

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
like image 121
Phil Avatar answered Nov 06 '22 13:11

Phil