设为首页 加入收藏

TOP

Sybase查询表结构的方法(类似于Oracle的Desc)(八)
2015-07-24 11:22:52 来源: 作者: 【 】 浏览:36
Tags:Sybase 查询表 结构 方法 类似 Oracle Desc
*/ select attribute_class = convert(varchar(512), c.char_value), attribute = convert(varchar(512), a.char_value), t.int_value, char_value = convert(varchar(512), t.char_value), t.comments into #sphelp6rs from sysattributes t, master.dbo.sysattributes c, master.dbo.sysattributes a where t.object_type = "P" and t.object = object_id(@objname) and c.class = 0 and c.attribute = 0 and a.class = 0 and a.attribute = 1 and t.class = c.object and t.class = a.object and t.attribute = a.object_info1 exec sp_autoformat @fulltabname = #sphelp6rs drop table #sphelp6rs end end /* ** If the object is a table, check out the indexes. */ if @sysstat & 15 in (1, 3) execute dbo.sp_helpindex @objname /* ** If the object is a table or view, check out the keys. */ if @sysstat & 15 in (1, 2, 3) execute dbo.sp_helpkey @objname /* ** If the object is a table, check out the slices/partitions */ if @sysstat & 15 in (1, 3) execute dbo.sp_helpartition @objname /* ** If the object is a trigger, it is either enabled or disabled */ if @sysstat & 15 in (0,8) begin /* ** 1048676 <==> 0x100000 <==> insert trigger disabled ** 2097152 <==> 0x200000 <==> delete trigger disabled ** 4194304 <==> 0x400000 <==> update trigger disabled */ if exists (select 1 from sysobjects trig, sysobjects tab where trig.id = object_id(@objname) and trig.deltrig = tab.id and ((trig.id = tab.deltrig and tab.sysstat2 & 2097152 <> 0) or (trig.id = tab.updtrig and tab.sysstat2 & 4194304 <> 0) or (trig.id = tab.instrig and tab.sysstat2 & 1048576 <> 0))) exec sp_getmessage 17581, @msg out else exec sp_getmessage 17582, @msg out print @msg end /* ** If the object is a table, display the table level LOB compression level */ if @sysstat & 15 in (1, 3) begin select @tab_lob_cmplvl = lobcomp_lvl from sysobjects where id = object_id(@objname) select @msg = "Table LOB compression level " + convert(varchar(3), @tab_lob_cmplvl) print @msg if exists (select 1 from sysattributes where object_type="TI" and object_info1 & 4096 = 4096 and object = object_id(@objname)) begin select @msg = "Table " + @objname + " has columns dropped by no datacopy method." print @msg end end /* ** Print the lock scheme information for the table objects */ if @sysstat & 15 in (1, 3) begin /* ** the bits 0x2000, 0x4000 & 0x8000 represents any ** explicit lock scheme bits that can be set, so ** get them out ( 0x2000 + 0x4000 + 0x8000 = 57344) */ select @sysstat2 = (sysstat2 & 57344) from sysobjects where id = object_id(@objname) /* ** The value 0, refers that no lock scheme is ** specified (old style tables) so they support only ** allpages locking */ if (@sysstat2 in (0, 8192, 16384, 32768)) begin if (@sysstat2 = 8192 or @sysstat2 = 0) begin /* 17576, "Lock scheme is Allpages" */ exec sp_getmessage 17576, @msg out print @msg /* 18571, "The attribute '%1!' is */ /* not applicable to tables with */ /* allpages lock scheme." */ exec sp_getmessage 18571, @msg out print @msg, 'exp_row_size' /* 18571, "The attribute '%1!' is */ /* not applicable to tables with */ /* allpages lock scheme." */ exec sp_getmessage 18571, @msg out print @msg, 'concurrency_opt_threshold' end if ( @sysstat2 = 16384 ) begin /* 17577, "Lock scheme is Datapages" */ exec sp_getmessage 17577, @msg out print @msg /* 18983, "The '%1!' attribute is not applicable **
首页 上一页 5 6 7 8 9 下一页 尾页 8/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇先打11.2.0.3.8这个PSU,后建库 下一篇oracle巡检脚本-部分

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·在 Redis 中如何查看 (2025-12-26 03:19:03)
·Redis在实际应用中, (2025-12-26 03:19:01)
·Redis配置中`require (2025-12-26 03:18:58)
·Asus Armoury Crate (2025-12-26 02:52:33)
·WindowsFX (LinuxFX) (2025-12-26 02:52:30)