设为首页 加入收藏

TOP

Sybase查询表结构的方法(类似于Oracle的Desc)(二)
2015-07-24 11:22:52 来源: 作者: 【 】 浏览:25
Tags:Sybase 查询表 结构 方法 类似 Oracle Desc
cts */ declare @db_stat4 int declare @db_dealloc_ftp int /* Dealloc FTP after NULL update */ declare @tab_keep_ftp int /* Keep FTP after NULL update */ declare @tab_dealloc_ftp int /* Dealloc FTP after NULL update */ if @@trancount = 0 begin set chained off end set transaction isolation level 1 select @sptlang = @@langid if @@langid != 0 begin if not exists ( select * from master.dbo.sysmessages where error between 17100 and 17109 and langid = @@langid) select @sptlang = 0 end set nocount on /* ** If no @objname given, give a little info about all objects. ** Note: 0x80f is the mask for sysstats (=2063decimal). ** 800 is used by Stratus for external tables. */ select @sqlj_proc = hextoint("0x2000000") if @objname is NULL begin -- { /* ** Instead of Triggers are sub_types of trigger ** type; so first check for sysstat to be 8, then build the ** prefix of "instead of" for the trigger if needed. */ select Name = o.name, Owner = user_name(uid), Object_type = (case when ((o.sysstat & 15) = 8) then (case when (o.type = "IT") then "instead of " else null end) else null end ) + (m.description + x.name) into #sphelp1rs from sysobjects o, master.dbo.spt_values v, master.dbo.spt_values x, master.dbo.sysmessages m where o.sysstat & 2063 = v.number and ((v.type = "O" and (o.type != "XP" and ((o.sysstat2 & @sqlj_proc) = 0 or o.type = "U" or o.type = "S")) and (o.type != "RS")) /* precomputed result set */ or (v.type = "O1" and o.type = "XP") or (v.type = "O2" and (o.sysstat2 & @sqlj_proc) != 0 and o.type != "U" and o.type != "S") or (v.type = "O1" and o.type ="RS") /* precomputed result set */ or (v.type = "EK" and o.type = "EK")) and v.msgnum = m.error and isnull(m.langid, 0) = @sptlang and ((m.error between 17100 and 17109) or (m.error between 17587 and 17589) or (m.error between 18903 and 18904) or (m.error = 17588 or m.error = 17139 or m.error = 17015)) and x.type = "R" and o.userstat & -32768 = x.number exec sp_autoformat @fulltabname = #sphelp1rs, @orderby = "order by 3 desc, 1 asc" drop table #sphelp1rs select User_type = s.name, Storage_type = st.name, Length = s.length, Nulls = s.allownulls, Default_name = object_name(s.tdefault), Rule_name = object_name(s.domain), Access_Rule_name = object_name(s.accessrule) into #sphelp2rs from systypes s, systypes st where s.type = st.type and s.usertype > 99 and st.name not in ("sysname", "longsysname", "nchar", "nvarchar") and st.usertype < 100 exec sp_autoformat @fulltabname = #sphelp2rs, @orderby = "order by 1" drop table #sphelp2rs /* Display list of Java classes installed in this database */ print "" select Class_name = x.xtname, Jar_name = isnull(j.jname, '') into #sphelp3rs from sysxtypes x, sysjars j where x.xtcontainer *= j.jid exec sp_autoformat @fulltabname = #sphelp3rs, @orderby = "order by 1" drop table #sphelp3rs /* Display list of Java JARs installed in this database */ print "" exec sp_autoformat @fulltabname = sysjars, @selectlist = "'Jar_name' = jname", @orderby = "order by 1" print "" return (0) end -- } /* ** If this is a 4-part object name, mangle the name appropriately. ** [Note: this must be run in tempdb for successful results.] */ if @objname like "%.%.%.%" begin select @objname = str_replace(@objname, '.', '_') end /* ** Make sure the @objname is local to the current database. */ if @objname like "%.%.%" and su
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇先打11.2.0.3.8这个PSU,后建库 下一篇oracle巡检脚本-部分

评论

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

·新书介绍《Python数 (2025-12-25 04:49:47)
·怎么利用 Python 进 (2025-12-25 04:49:45)
·金融界大佬力荐,Pyt (2025-12-25 04:49:42)
·你必须要弄懂的多线 (2025-12-25 04:22:35)
·如何在 Java 中实现 (2025-12-25 04:22:32)