CREATE VIEW sys.sysobjects AS
SELECT name, id,
xtype = type collate database_default,
uid = convert(smallint, nsid),
info = convert(smallint, 0),
status = convert(int, 0),
base_schema_ver = convert(int, 0),
replinfo = convert(int, 0),
parent_obj = pid,
crdate = created,
ftcatid = convert(smallint, case type
when 'U' then OBJECTPROPERTY(id, 'TableFulltextCatalogId')
else 0 end),
schema_ver = convert(int, 0),
stats_schema_ver = convert(int, 0),
type = convert(char(2), case type
when 'UQ' then 'K' when 'PK' then 'K'
else type collate database_default end),
userstat = convert(smallint, case type when 'S' then 1 when 'U' then 1 else 0 end),
sysstat = convert(smallint, case type
when 'S' then 1 when 'V' then 2 when 'U' then 3 when 'P' then 4 when 'RF' then 4
when 'X' then 4 when 'D' then 6 when 'R' then 7 when 'TR' then 8
when 'PK' then 9 when 'UQ' then 9 when 'C' then 10 when 'F' then 11
else 0 end),
indexdel = convert(smallint, 0),
refdate = created,
version = convert(int, 0),
deltrig = convert(int, case type
when 'U' then OBJECTPROPERTY(id,'TableDeleteTrigger')
when 'TR' then pid else 0 end),
instrig = convert(int, case type
when 'U' then OBJECTPROPERTY(id,'TableInsertTrigger')
else 0 end),
updtrig = convert(int, case type
when 'U' then OBJECTPROPERTY(id,'TableUpdateTrigger')
else 0 end),
seltrig = convert(int, 0),
category = convert(int, case when type = 'D' and pid <> 0 then 2048 else 0 end
+ case when type = 'P' and (status & 256) <> 0 then 16 else 0 end
+ (status & 1)*2 + (status & 16)*2),
cache = convert(smallint, 0)
FROM sys.sysschobjs
WHERE nsclass = 0 AND pclass = 1 AND has_access('CO', id) = 1
UNION ALL
SELECT name, id = object_id,
xtype = type collate database_default,
uid = convert(smallint, schema_id),
info = convert(smallint, 0),
status = convert(int, 0),
base_schema_ver = convert(int, 0),
replinfo = convert(int, 0),
parent_obj = sysconv(int, 0),
crdate = create_date,
ftcatid = convert(smallint, 0),
schema_ver = convert(int, 0),
stats_schema_ver = convert(int, 0),
type = type collate database_default,
userstat = convert(smallint, 0),
sysstat = convert(smallint, case type when 'V' then 2 when 'P' then 4 when 'X' then 4 else 0 end),
indexdel = convert(smallint, 0),
refdate = create_date,
version = convert(int, 0),
deltrig = convert(int, 0),
instrig = convert(int, 0),
updtrig = convert(int, 0),
seltrig = convert(int, 0),
category = convert(int, 2),
cache = convert(smallint, 0)
FROM sys.system_objects$