--
--                            Utility SPT_VALUES
--
use sybsystemprocs
go

set string_rtruncation on
go
drop table usptvalues
go

create table usptvalues
  (type      char (3)       not null,
   number    int            not null,
   name      varchar (78)   not null,
   aux1      tinyint        not null,
   aux2      tinyint        not null,

   primary key clustered (type, number, aux1))
go

insert into usptvalues  values ('EXP', -1, 'EXCLUDED STORED PROCEDURE PREFIXES', 0, 0)
go

insert into usptvalues  values ('EXT', -1, 'EXCLUDED TABLE PREFIXES', 0, 0)
go
insert into usptvalues  values ('EXT', 1, 'pb',  0, 0)
insert into usptvalues  values ('EXT', 2, 'sr_', 0, 0)
insert into usptvalues  values ('EXT', 3, 'sys', 0, 0)
go

insert into usptvalues  values ('EXV', -1, 'EXCLUDED VIEW PREFIXES', 0, 0)
go
insert into usptvalues  values ('EXV', 1, 'sr_', 0, 0)
go

insert into usptvalues
   select type, number, name, isnull (low, 0), isnull (high, 0)
   from master.dbo.spt_values
   where type in ('A', 'B', 'D', 'D2', 'O', 'S')
     and name <> 'trunc. log on chkpt.'
go

insert into usptvalues
   select 'E4', low, name, 0, 0
   from master.dbo.spt_values
   where type   = 'E'
     and number = 4
go

insert into usptvalues
   values ('P', -1, 'PROTECT COMPUTATIONS', 0, 0)
go
insert into usptvalues
   select 'P', number, ' ', low, high
   from master.dbo.spt_values
   where type = 'P'
go
delete from usptvalues
where type    = 'D'
  and name like 'trunc.%'
go
delete from usptvalues
where type   = 'O'
  and number = 10
go
update usptvalues
set name = 'rule / check constraint'
where type   = 'O'
  and number = 7
go

insert into usptvalues values ('LK',  -1, 'LOCK SUBTYPES',                                            0, 0)
insert into usptvalues values ('LK',   0, '?',                                                        0, 0)
insert into usptvalues values ('LK',   1, 'Exclusive table',                                          0, 0)
insert into usptvalues values ('LK',   2, 'Shared table',                                             0, 0)
insert into usptvalues values ('LK',   3, 'Exclusive intent',                                         0, 0)
insert into usptvalues values ('LK',   4, 'Shared intent',                                            0, 0)
insert into usptvalues values ('LK',   5, 'Exclusive page',                                           0, 0)
insert into usptvalues values ('LK',   6, 'Shared page',                                              0, 0)
insert into usptvalues values ('LK',   7, 'Update page',                                              0, 0)
insert into usptvalues values ('LK',   8, 'Exclusive row',                                            0, 0)
insert into usptvalues values ('LK',   9, 'Shared row',                                               0, 0)
insert into usptvalues values ('LK',  10, 'Update row',                                               0, 0)
insert into usptvalues values ('LK',  11, 'Shared next key',                                          0, 0)
insert into usptvalues values ('LK', 256, ', Lock is blocking another process',                       0, 0)
insert into usptvalues values ('LK', 512, ', Demand lock',                                            0, 0)
insert into usptvalues values ('LK', 768, ', Request lock',                                           0, 0)
go
insert into usptvalues values ('LK2',  0, ' ',                                                        0, 0)
insert into usptvalues values ('LK2',  1, ', Sync duration',                                          0, 0)
go

insert into usptvalues values ('OP',  -2, ' ',                                                        0, 0)
insert into usptvalues values ('OP',  -1, 'LOG OP CODES',                                             0, 0)
insert into usptvalues values ('OP',   0, 'Transaction begin',                                        0, 0)
insert into usptvalues values ('OP',   4, 'Data page insert',                                         0, 0)
insert into usptvalues values ('OP',   5, 'Data page delete',                                         0, 0)
insert into usptvalues values ('OP',   6, 'Indirect insert (from deferred insert/update)',            0, 0)
insert into usptvalues values ('OP',   7, 'Index page insert',                                        0, 0)
insert into usptvalues values ('OP',   8, 'Index page delete',                                        0, 0)
insert into usptvalues values ('OP',   9, 'Direct replace/update',                                    0, 0)
insert into usptvalues values ('OP',  10, 'No Op (skipped in recovery)',                              0, 0)
insert into usptvalues values ('OP',  11, 'Logged in first phase of deferred insert/update',          0, 0)
insert into usptvalues values ('OP',  12, 'Logged in first phase of deferred delete/update',          0, 0)
insert into usptvalues values ('OP',  13, 'Page allocation',                                          0, 0)
insert into usptvalues values ('OP',  14, 'Next available object id for a creation',                  0, 0)
insert into usptvalues values ('OP',  15, 'Generated by 4801 (?)',                                    0, 0)
insert into usptvalues values ('OP',  16, 'Page split',                                               0, 0)
insert into usptvalues values ('OP',  17, 'Checkpoint',                                               0, 0)
insert into usptvalues values ('OP',  18, 'Transaction save',                                         0, 0)
insert into usptvalues values ('OP',  19, 'Logged when any "update" begins',                          0, 0)
insert into usptvalues values ('OP',  20, 'Sort page deallocations',                                  0, 0)
insert into usptvalues values ('OP',  21, 'Page deallocation',                                        0, 0)
insert into usptvalues values ('OP',  22, 'Delete all extents on allocation page',                    0, 0)
insert into usptvalues values ('OP',  23, 'Allocate extent - mark all pages used',                    0, 0)
insert into usptvalues values ('OP',  24, 'Allocation for new page of a split',                       0, 0)
insert into usptvalues values ('OP',  25, 'Direct sysindexes change',                                 0, 0)
insert into usptvalues values ('OP',  27, 'Sort record',                                              0, 0)
insert into usptvalues values ('OP',  28, 'SODEALLOC record',                                         0, 0)
insert into usptvalues values ('OP',  30, 'Transaction end',                                          0, 0)
insert into usptvalues values ('OP',  31, 'Sort timestamp record',                                    0, 0)
insert into usptvalues values ('OP',  32, 'Text insert - direct',                                     0, 0)
insert into usptvalues values ('OP',  33, 'Text insert - deferred',                                   0, 0)
insert into usptvalues values ('OP',  34, 'Text delete - deferred',                                   0, 0)
insert into usptvalues values ('OP',  35, 'Indirect insert (log record)',                             0, 0)
insert into usptvalues values ('OP',  36, 'Text delete - log record',                                 0, 0)
insert into usptvalues values ('OP',  37, 'OAM page allocation',                                      0, 0)
insert into usptvalues values ('OP',  38, 'OAM page deallocation',                                    0, 0)
insert into usptvalues values ('OP',  39, 'OAM entry insertion',                                      0, 0)
insert into usptvalues values ('OP',  40, 'OAM entry deletion',                                       0, 0)
insert into usptvalues values ('OP',  41, 'OAM allocation during create/sort',                        0, 0)
insert into usptvalues values ('OP',  42, 'No Op cmd record',                                         0, 0)
go
--
--   43/50 are for Replication Server
--
insert into usptvalues values ('OP',  43, 'Record for stored proc begin exec',                        0, 0)
insert into usptvalues values ('OP',  44, 'Record for stored proc complete',                          0, 0)
insert into usptvalues values ('OP',  45, 'Dump database sync',                                       0, 0)
insert into usptvalues values ('OP',  46, 'Truncation point save',                                    0, 0)
insert into usptvalues values ('OP',  47, 'Load database sync',                                       0, 0)
insert into usptvalues values ('OP',  48, 'Load transaction sync',                                    0, 0)
insert into usptvalues values ('OP',  49, 'Before/after image for replication',                       0, 0)
insert into usptvalues values ('OP',  50, 'Reserved for Replication Server',                          0, 0)
--
insert into usptvalues values ('OP',  51, 'Move OAM entries between OAM pages',                       0, 0)
insert into usptvalues values ('OP',  52, 'Record attribute data on OAM',                             0, 0)
insert into usptvalues values ('OP',  53, 'Deleted a column from a row',                              0, 0)
insert into usptvalues values ('OP',  54, 'Deallocate a run of log pages',                            0, 0)
insert into usptvalues values ('OP',  55, 'Data slice control page',                                  0, 0)
insert into usptvalues values ('OP',  56, 'Deferred insert of an index row',                          0, 0)
insert into usptvalues values ('OP',  58, 'Table/procedure schema versioning (replication support)',  0, 0)
insert into usptvalues values ('OP',  59, 'Column/parameter schema versioning (replication support)', 0, 0)
insert into usptvalues values ('OP',  60, 'Prepare to commit',                                        0, 0)
insert into usptvalues values ('OP',  61, 'Start of a top action',                                    0, 0)
insert into usptvalues values ('OP',  62, 'End of a top action',                                      0, 0)
insert into usptvalues values ('OP',  63, 'Insert log record for data row of data-only locked table', 0, 0)
insert into usptvalues values ('OP',  64, 'Counterpart of XREC_INSIND for DOL table',                 0, 0)
insert into usptvalues values ('OP',  65, 'Update log record for DOL table',                          0, 0)
insert into usptvalues values ('OP',  66, 'Delete log record for data row of data-only locked table', 0, 0)
insert into usptvalues values ('OP',  67, 'Garbage collection log record for DOL table',              0, 0)
insert into usptvalues values ('OP',  68, 'Deferred update log record for DOL table',                 0, 0)
insert into usptvalues values ('OP',  69, 'Page alloc without links to neighbors',                    0, 0)
insert into usptvalues values ('OP',  70, 'Counterpart of XREC_DNOOP for DOL tables',                 0, 0)
insert into usptvalues values ('OP',  71, 'Btree leaf/nonleaf insert',                                0, 0)
insert into usptvalues values ('OP',  72, 'Btree leaf/nonleaf delete',                                0, 0)
insert into usptvalues values ('OP',  73, 'Btree leaf/nonleaf split',                                 0, 0)
insert into usptvalues values ('OP',  74, 'Btree garbage collect leaf',                               0, 0)
insert into usptvalues values ('OP',  75, 'System catalog rows for the source table of create index', 0, 0)
insert into usptvalues values ('OP',  76, 'End of sort log record',                                   0, 0)
insert into usptvalues values ('OP',  77, 'New log record from dropextents',                          0, 0)
insert into usptvalues values ('OP',  82, 'dbtable structure change (X-DB commit, dbcc pfts, etc.)',  0, 0)
go

insert into usptvalues
      values ('SET',           0, 'SET VALUES VIA @@options',            0, 0)
go
insert into usptvalues
      values ('SET', -2147483648, 'arithabort numeric_truncation',       0, 0)
insert into usptvalues
      values ('SET',           1, 'quoted_identifier',                   0, 0)
insert into usptvalues
      values ('SET',           1, 'jtc',                                 1, 0)
insert into usptvalues
      values ('SET',           2, 'forceplan',                           0, 0)
insert into usptvalues
      values ('SET',           8, 'chained',                             0, 0)
insert into usptvalues
      values ('SET',          32, 'close on endtran',                    0, 0)
insert into usptvalues
      values ('SET',          64, 'fipsflagger',                         0, 0)
insert into usptvalues
      values ('SET',         512, 'cis_rpc_handling',                    1, 0)

--insert into usptvalues
--    values ('SET',        1024, 'procid',                              0, 0)

insert into usptvalues
      values ('SET',        1024, 'strict_dtm_enforcement',              1, 0)
insert into usptvalues
      values ('SET',        4096, 'rowcount',                            0, 0)
insert into usptvalues
      values ('SET',       16834, 'sort_merge',                          1, 0)
insert into usptvalues
      values ('SET',       32768, 'nocount',                             0, 0)
insert into usptvalues
      values ('SET',       65536, 'arithabort arith_overflow',           0, 0)
insert into usptvalues
      values ('SET',       65536, 'prefetch',                            1, 0)
insert into usptvalues
      values ('SET',     1048576, 'process_limit_action warning',        1, 0)
insert into usptvalues
      values ('SET',     2097152, 'process_limit_action abort',          1, 0)
insert into usptvalues
      values ('SET',     8388608, 'statistics',                          0, 0)
insert into usptvalues
      values ('SET',     8388608, 'sort_resources',                      1, 0)
insert into usptvalues
      values ('SET',    16777216, 'self_recursion',                      1, 0)
insert into usptvalues
      values ('SET',    33554432, 'ansinull',                            1, 0)
insert into usptvalues
      values ('SET',   268435456, 'showplan',                            0, 0)
insert into usptvalues
      values ('SET',   268435456, 'flushmessage',                        1, 0)
insert into usptvalues
      values ('SET',   536870912, 'ansi_permissions',                    1, 0)
insert into usptvalues
      values ('SET',  1073741824, 'arithignore',                         0, 0)
insert into usptvalues
      values ('SET',  1073741824, 'string_rtruncation',                  1, 0)
go

insert into usptvalues values ('TA', -1, 'TOKEN ACTION', 0, 0)
go
insert into usptvalues
   select 'TA', number, name, 0, 0
   from master.dbo.spt_values
   where type   = 'T'
     and number > -1
     and ((number < 204)  or  (number > 206))
go

insert into usptvalues values ('TP', -1, 'TOKEN PROTECTTYPE', 0, 0)
insert into usptvalues values ('TP',  0, 'Grant*',            0, 0)
insert into usptvalues values ('TP',  1, 'Grant',             0, 0)
insert into usptvalues values ('TP',  2, 'Revoke',            0, 0)
go

insert into usptvalues
      values ('TYP',   -2, 'VALID USERTYPE / STORAGE TYPE COMBINATIONS', 0, 0)
go
insert into usptvalues
      values ('TYP',   -1, 'extended type / extended type',  36, 0)
insert into usptvalues
      values ('TYP',    1, 'char          / varchar',        39, 0)
insert into usptvalues
      values ('TYP',    1, 'char          / char',           47, 0)
insert into usptvalues
      values ('TYP',    2, 'varchar       / varchar',        39, 0)
insert into usptvalues
      values ('TYP',    3, 'binary        / varbinary',      37, 0)
insert into usptvalues
      values ('TYP',    3, 'binary        / binary',         45, 0)
insert into usptvalues
      values ('TYP',    4, 'varbinary     / varbinary',      37, 0)
insert into usptvalues
      values ('TYP',    5, 'tinyint       / intn',           38, 0)
insert into usptvalues
      values ('TYP',    5, 'tinyint       / tinyint',        48, 0)
insert into usptvalues
      values ('TYP',    6, 'smallint      / intn',           38, 0)
insert into usptvalues
      values ('TYP',    6, 'smallint      / smallint',       52, 0)
insert into usptvalues
      values ('TYP',    7, 'int           / intn',           38, 0)
insert into usptvalues
      values ('TYP',    7, 'int           / int',            56, 0)
insert into usptvalues
      values ('TYP',    8, 'float         / real',           59, 0)
insert into usptvalues
      values ('TYP',    8, 'float         / float',          62, 0)
insert into usptvalues
      values ('TYP',    8, 'float         / floatn',        109, 0)
insert into usptvalues
      values ('TYP',   10, 'numeric       / numeric',        63, 0)
insert into usptvalues
      values ('TYP',   10, 'numeric       / numericn',      108, 0)
insert into usptvalues
      values ('TYP',   11, 'money         / money',          60, 0)
insert into usptvalues
      values ('TYP',   11, 'money         / moneyn',        110, 0)
insert into usptvalues
      values ('TYP',   12, 'datetime      /datetime',        61, 0)
insert into usptvalues
      values ('TYP',   12, 'datetime      /datetimn',       111, 0)
insert into usptvalues
      values ('TYP',   16, 'bit           / bit',            50, 0)
insert into usptvalues
      values ('TYP',   18, 'sysname       / sysname',        39, 0)
insert into usptvalues
      values ('TYP',   19, 'text          / text',           35, 0)
insert into usptvalues
      values ('TYP',   20, 'image         / image',          34, 0)
insert into usptvalues
      values ('TYP',   21, 'smallmoney    / moneyn',        110, 0)
insert into usptvalues
      values ('TYP',   21, 'smallmoney    / smallmoney',    122, 0)
insert into usptvalues
      values ('TYP',   22, 'smalldatetime / smalldatetime',  58, 0)
insert into usptvalues
      values ('TYP',   22, 'smalldatetime / datetimn',      111, 0)
insert into usptvalues
      values ('TYP',   23, 'real          / real',           59, 0)
insert into usptvalues
      values ('TYP',   23, 'real          / floatn',        109, 0)
insert into usptvalues
      values ('TYP',   24, 'nchar         / varchar',        39, 0)
insert into usptvalues
      values ('TYP',   24, 'nchar         / char',           47, 0)
insert into usptvalues
      values ('TYP',   25, 'nvarchar      / nvarchar',       39, 0)
insert into usptvalues
      values ('TYP',   26, 'decimal       / decimal',        55, 0)
insert into usptvalues
      values ('TYP',   26, 'decimal       / decimaln',      106, 0)
insert into usptvalues
      values ('TYP',   80, 'timestamp     / varbinary',      37, 0)
go

insert into usptvalues values ('V',    -1,' SYSDEVICES STATUS',           0, 0)
go
insert into usptvalues values ('V',     1, 'Default disk',                0, 0)
insert into usptvalues values ('V',     2, 'Physical disk',               0, 0)
insert into usptvalues values ('V',     4, 'Logical disk',                0, 0)
insert into usptvalues values ('V',     8, 'Skip header',                 0, 0)
insert into usptvalues values ('V',    16, 'Dump device',                 0, 0)
insert into usptvalues values ('V',    32, 'Serial writes',               0, 0)
insert into usptvalues values ('V',    64, 'Mirrored',                    0, 0)
insert into usptvalues values ('V',   128, 'Reads mirrored',              0, 0)
insert into usptvalues values ('V',   256, 'Secondary mirror only',       0, 0)
insert into usptvalues values ('V',   512, 'Mirror enabled',              0, 0)
insert into usptvalues values ('V',  1024, 'Master device is mirrored',   0, 0)
insert into usptvalues values ('V',  2048, 'Mirror disabled',             0, 0)
insert into usptvalues values ('V',  4096, 'Primary needs unmirroring',   0, 0)
insert into usptvalues values ('V',  8192, 'Secondary needs unmirroring', 0, 0)
insert into usptvalues values ('V', 16384, 'Dsync',                       0, 0)
go

insert into usptvalues values ('X', -1, 'SYSSERVERS SRVCLASS', 0, 0)
insert into usptvalues values ('X',  0, 'local',               0, 0)
insert into usptvalues values ('X',  1, 'SQL Server',          0, 0)
insert into usptvalues values ('X',  3, 'CIS: DC type',        0, 0)
insert into usptvalues values ('X',  4, 'CIS: DB2 type',       0, 0)
insert into usptvalues values ('X',  5, 'CIS: generic',        0, 0)
go


insert into usptvalues
      values ('XRC', -1, 'RECONSTRAIN TEXT',                                                              0, 0)
go
insert into usptvalues
      values ('XRC',  0, '---------------------- PROLOG -----------------------------------------------', 0, 0)
insert into usptvalues
      values ('XRC',  3, '---------------------- DROP REFERENTIAL CONSTRAINTS -------------------------', 0, 0)
insert into usptvalues
      values ('XRC',  4, '---------------------- DROP INDEXES -----------------------------------------', 0, 0)
insert into usptvalues
      values ('XRC',  5, '---------------------- DROP INDEX CONSTRAINTS -------------------------------', 0, 0)
insert into usptvalues
      values ('XRC',  6, '---------------------- USER SUPLIED CODE STUB -------------------------------', 0, 0)
insert into usptvalues
      values ('XRC',  6, '--',                                                                            1, 0)
insert into usptvalues
      values ('XRC',  6, '--  USER SUPPLIED CODE',                                                        2, 0)
insert into usptvalues
      values ('XRC',  6, '--',                                                                            3, 0)
insert into usptvalues
      values ('XRC',  7, '---------------------- RECREATE THE CLUSTERED INDEX -------------------------', 0, 0)
insert into usptvalues
      values ('XRC',  8, '---------------------- RECREATE THE CLUSTERED INDEX CONSTRAINT --------------', 0, 0)
insert into usptvalues
      values ('XRC',  9, '---------------------- RECREATE NONCLUSTERED INDEXES ------------------------', 0, 0)
insert into usptvalues
      values ('XRC', 10, '---------------------- RECREATE NONCLUSTERED INDEX CONSTRAINTS --------------', 0, 0)
insert into usptvalues
      values ('XRC', 11, '---------------------- RECREATE REFERENTIAL CONSTRAINTS ---------------------', 0, 0)
insert into usptvalues
      values ('XRC', 12, '---------------------- RESET TABLE/INDEX ATTRIBUTES -------------------------', 0, 0)
insert into usptvalues
      values ('XRC', 13, '---------------------- RESET TABLE/INDEX ATTRIBUTES -------------------------', 0, 0)
insert into usptvalues
      values ('XRC', 14, '---------------------- RESET TABLE/INDEX ATTRIBUTES -------------------------', 0, 0)
insert into usptvalues
      values ('XRC', 15, '---------------------- RESET TABLE/INDEX ATTRIBUTES -------------------------', 0, 0)
insert into usptvalues
      values ('XRC', 16, '---------------------- RESET TABLE/INDEX ATTRIBUTES -------------------------', 0, 0)
insert into usptvalues
      values ('XRC', 18, '---------------------- EPILOG -----------------------------------------------', 0, 0)
go

insert into usptvalues
      values ('XRI', -1, 'REINDEX TEXT',                                                                  0, 0)
go
insert into usptvalues
      values ('XRI',  2, '---------------------- DROP ALL REFERENTIAL CONSTRAINTS ---------------------', 0, 0)
insert into usptvalues
      values ('XRI',  3, '---------------------- DROP ALL INDEXES ON ALLPAGES TABLES ------------------', 0, 0)
insert into usptvalues
      values ('XRI',  4, '---------------------- DROP ALL INDEX CONSTRAINTS ON ALLPAGES TABLES --------', 0, 0)
insert into usptvalues
      values ('XRI', 16, '---------------------- ADD ALL REFERENTIAL CONSTRAINTS ----------------------', 0, 0)
insert into usptvalues
      values ('XRI', 17, '---------------------- EPILOG -----------------------------------------------', 0, 0)
go

update statistics usptvalues
go

dump transaction sybsystemprocs with truncate_only
go
