|
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 |