執行sql
select o.name,cl.name,cm.text from sysobjects o,syscolumns cl, syscomments cm
where o.id = cl.id and cl.cdefault = cm.id and o.type='U'
and o.name='test2' and cl.name like 'col%'
test2是標明, col%是列名通配符, 'U' 表示表格是用戶表
返回結果:
name name text
---- ---- ----
test2 col1 DEFAULT (0)
test2 col2 DEFAULT 2
test2 col3 DEFAULT getdate()
syscolumns 中 id 表示對應的表格在sysobjects中id, cdefault表示在syscomments中的缺省值注釋id
缺省值可能會出現函數, 例如 default getdate(),
所以我覺得應該這個缺省值可以剝離掉default, 如果使用hibernate實現,還只能用dynamic insert,dynamic update.
文章來源:
http://stocknewbie.bokee.com/viewdiary.31463433.html
posted on 2009-05-01 10:52
huohuo 閱讀(488)
評論(0) 編輯 收藏