12
如果您運行此腳本來檢索所有默認值definations在數據庫:SQL Server默認值:爲什麼有一個或兩個括號?
select
c.name as columnname, t.name as tablename,
d.definition as value, d.name as constraintname
from
sys.default_constraints d
join sys.columns c
on d.parent_column_id = c.column_id
and d.parent_object_id = c.object_id
join sys.tables t
on c.object_id = t.object_id
你會得到像很多默認值:
(getdate())
((0))
('')
('2099-12-31')
我的問題是,爲什麼有括號?他們是否需要?爲什麼有些價值觀有一對,其他有兩個?在編寫T-SQL腳本時,是否正好遵循計數?