And*_*ren 6 sql-server-2008 sql-server insert default-value
有时在具有多列的表中插入数据时,如果插入语句不应该失败,知道必须指定哪些列会很有用。
我写了这个查询来找出哪些列不可为空、标识、计算、时间戳和没有默认值。
select *
from sys.columns
where object_id = object_id('<table>') and
is_nullable = 0 and
is_identity = 0 and
is_computed = 0 and
default_object_id = 0 and
type_name(system_type_id) <> 'timestamp'
Run Code Online (Sandbox Code Playgroud)
此检查中是否应包含任何其他属性?
归档时间: |
|
查看次数: |
210 次 |
最近记录: |