home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 4 / SuperCD_4.iso / server / servpak1.65 / u_tables.sql < prev    next >
Text File  |  1996-07-29  |  37KB  |  1,164 lines

  1.  
  2. /*
  3. ** U_Tables.CQL    1996/07/10 22:33
  4. **
  5. ** (From old Install\InstMsgs.SQL)
  6. **
  7. ** Copyright Microsoft, Inc. 1994, 1995, 1996
  8. ** All Rights Reserved.
  9. ** Use, duplication, or disclosure by the United States Government
  10. ** is subject to restrictions as set forth in subdivision (c) (1) (ii)
  11. ** of the Rights in Technical Data and Computer Software clause
  12. ** at CFR 252.227-7013. Microsoft, Inc. One Microsoft Way, Redmond WA
  13. ** 98052.
  14. */
  15.  
  16. go
  17. use master
  18. go
  19. dump tran master with no_log
  20. go
  21. set nocount on
  22. go
  23.  
  24. declare @vdt varchar(99)
  25. select  @vdt = convert(varchar,getdate(),113)
  26. raiserror('Starting Install\SptValue.SQL at  %s',0,1,@vdt) with nowait
  27. raiserror('This file creates all the ''SPT_'' tables.',0,1)
  28. go
  29.  
  30.  
  31. /****************  No system sprocs, thus 'allow updates' unneeded for this file.
  32. print ''
  33. print 'Making sure that updates to system tables are allowed.'
  34. -go
  35.  
  36. declare  @dbcc_current_version    integer
  37.     ,@int1            integer
  38. dbcc getvalue('current_version')
  39. select @dbcc_current_version = @@error
  40.  
  41. if (     exists (select * from sysobjects where name='sp_configure')
  42.     AND  @dbcc_current_version = (select version from sysdatabases where name='master')
  43.     AND  1 <> (select value from syscurconfigs where config = 102)
  44.    )
  45.     begin                        --Query tree compatible
  46.     exec @int1 = sp_configure 'allow updates',1
  47.     if @@error <> 0 or @int1 <> 0
  48.         raiserror('Bad sp_configure exec at top of SptValue.SQL, killing spid.'
  49.             ,22,127) with log
  50.     reconfigure with override
  51.     end
  52. -go
  53.  
  54.  
  55. -- Make sure server was started in single user mode or that sp_configure was used
  56. -- to enable updates to system tables.
  57.  
  58. if (select value from syscurconfigs where config = 102) <> 1
  59.     raiserror('Cannot run SptValue.SQL unless updates to system tables are enabled. Shutdown server and restart with the ''-m'' option or use sp_configure to enable updates to system tables.'
  60.         ,22,127) with log
  61. -go
  62. ****************/
  63.  
  64. ------------------------------------------------------------------
  65. go
  66. exec sp_MS_upd_sysobj_category 1
  67. go
  68. ------------------------------------------------------------------
  69.  
  70. print ''
  71. print 'Dropping tables that will be (re)created by this script.'
  72. go
  73.  
  74. if exists (select * from sysobjects
  75.             where name = 'spt_committab'
  76.                 and sysstat & 0xf = 3)
  77.     begin
  78.     print 'Dropping TB spt_committab ...'
  79.     drop table spt_committab
  80.     end
  81.  
  82. if exists (select * from sysobjects
  83.             where name = 'spt_monitor'
  84.                 and sysstat & 0xf = 3)
  85.     begin
  86.     print 'Dropping TB spt_monitor ...'
  87.     drop table spt_monitor
  88.     end
  89.  
  90. if exists (select * from sysobjects
  91.         where name = 'spt_values'
  92.             and sysstat & 0xf = 3)
  93.     begin
  94.     print 'Dropping TB spt_values ...'
  95.     drop table spt_values
  96.     end
  97.  
  98. --------------------------------------------------
  99. if exists (select * from sysobjects
  100.         where name = 'spt_fallback_usg'
  101.             and sysstat & 0xf = 3)
  102.     begin
  103.     print 'Dropping TB spt_fallback_usg ...'
  104.     drop table spt_fallback_usg
  105.     end
  106.  
  107. if exists (select * from sysobjects
  108.         where name = 'spt_fallback_dev'
  109.             and sysstat & 0xf = 3)
  110.     begin
  111.     print 'Dropping TB spt_fallback_dev ...'
  112.     drop table spt_fallback_dev
  113.     end
  114.  
  115. if exists (select * from sysobjects
  116.         where name = 'spt_fallback_db'
  117.             and sysstat & 0xf = 3)
  118.     begin
  119.     print 'Dropping TB spt_fallback_dab ...'
  120.     drop table spt_fallback_db
  121.     end
  122. go
  123.  
  124. dump tran master with no_log
  125. go
  126.  
  127.  
  128.  
  129. ------------------------------------------------------------------
  130. ------------------------------------------------------------------
  131.  
  132.  
  133. raiserror(15339,-1,-1,'spt_committab')
  134. go
  135. CREATE TABLE    spt_committab
  136. (
  137.     commid        int        NOT NULL,    /* id used to refer to transaction */
  138.     start        datetime    NOT NULL,    /* time transaction started */
  139.     lastchange    datetime    NOT NULL,    /* last time this row was updated */
  140.     totnum        int        NOT NULL,    /*
  141.                             ** number of servers
  142.                             ** initially involved in xact
  143.                             */
  144.     outnum        int        NOT NULL,    /*
  145.                             ** number of servers
  146.                             ** who still have not completed
  147.                             */
  148.     status        char(1)        NOT NULL,    /* 'a'- abort, 'c'- commit, 'b'- begin */
  149.     applname    varchar(30)    NOT NULL,    /* application name */
  150.     xactname    varchar(30)    NOT NULL,    /* transaction name */
  151.     password    varchar(30)    NULL         /* password protection for updating */
  152. )
  153. go
  154.  
  155. print 'Creating Unique Clustered index on spt_committab ...'
  156. go
  157. create unique clustered index commitclust on spt_committab(commid)
  158. go
  159.  
  160.  
  161. ---------------------------------------
  162.  
  163. raiserror(15339,-1,-1,'spt_monitor')
  164. go
  165.  
  166. create table spt_monitor
  167. (
  168.     lastrun        datetime    NOT NULL,
  169.     cpu_busy    int        NOT NULL,
  170.     io_busy        int        NOT NULL,
  171.     idle        int        NOT NULL,
  172.     pack_received    int        NOT NULL,
  173.     pack_sent    int        NOT NULL,
  174.     connections    int        NOT NULL,
  175.     pack_errors    int        NOT NULL,
  176.     total_read    int        NOT NULL,
  177.     total_write     int        NOT NULL,
  178.     total_errors     int        NOT NULL
  179. )
  180. go
  181.  
  182.  
  183. ---------------------------------------
  184.  
  185. raiserror(15339,-1,-1,'spt_values')
  186. go
  187. create table spt_values
  188. (
  189. name    varchar(35)        NULL,
  190. number    int        NOT NULL,
  191. type    char(3)        NOT NULL, --Make these unique to aid GREP (e.g. SOP, not SET or S).
  192. low    int            NULL,
  193. high    int            NULL,
  194. status    int            NULL  DEFAULT 0
  195. )
  196. go
  197.  
  198.  
  199. print ''
  200. print 'Creating indexes on table spt_values.'
  201. go
  202. print '   Unique Clustered ....'
  203. go
  204.  
  205. -- 'J','S','P'  challenge uniqueness.
  206. create Unique Clustered index spt_valuesclust on spt_values(type ,number ,name)
  207. go
  208.  
  209. print '   (nonUnique) Nonclustered ....'
  210. go
  211.  
  212. create Nonclustered index ix2_spt_values_nu_nc on spt_values(number, type)
  213. go
  214.  
  215.  
  216. ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
  217.  
  218. raiserror(15339,-1,-1,'spt_fallback_db')
  219. go
  220. create table spt_fallback_db
  221.    (
  222.     xserver_name           character varying(30)      not null
  223.    ,xdttm_ins              datetime                   not null
  224.    ,xdttm_last_ins_upd     datetime                   not null
  225.    ,xfallback_dbid         smallint                       null
  226.  
  227.    ,name                   character varying(30)      not null
  228.    ,dbid                   smallint                   not null
  229.    ,status                 smallint                   not null
  230.    ,version                smallint                   not null
  231.    )
  232. go
  233.  
  234. /****
  235. --Nice-to-have the uniqueness check, but extra 16 Mb in master db too precious.
  236. create unique Clustered
  237.    index    idx1
  238.    on       spt_fallback_db
  239.       (
  240.        xserver_name
  241.       ,name
  242.       )
  243. ****/
  244. go
  245.  
  246. ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
  247.  
  248. raiserror(15339,-1,-1,'spt_fallback_dev')
  249. go
  250. create table spt_fallback_dev
  251.    (
  252.     xserver_name           character varying(30)      not null
  253.    ,xdttm_ins              datetime                   not null
  254.    ,xdttm_last_ins_upd     datetime                   not null
  255.    ,xfallback_low          integer                        null
  256.    ,xfallback_drive        character(2)                   null
  257.  
  258.    ,low                    integer                    not null
  259.    ,high                   integer                    not null
  260.    ,status                 smallint                   not null
  261.    ,name                   character varying(30)      not null
  262.    ,phyname                character varying(127)     not null
  263.    )
  264. go
  265.  
  266. /****
  267. create unique Clustered
  268.    index    idx1
  269.    on       spt_fallback_dev
  270.       (
  271.        xserver_name
  272.       ,name
  273.       )
  274. ****/
  275. go
  276.  
  277. ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
  278.  
  279. raiserror(15339,-1,-1,'spt_fallback_usg')
  280. go
  281. create table spt_fallback_usg
  282.    (
  283.     xserver_name           character varying(30)      not null
  284.    ,xdttm_ins              datetime                   not null
  285.    ,xdttm_last_ins_upd     datetime                   not null
  286.    ,xfallback_vstart       integer                        null
  287.  
  288.    ,dbid                   smallint                   not null
  289.    ,segmap                 integer                    not null
  290.    ,lstart                 integer                    not null
  291.    ,sizepg                 integer                    not null
  292.    ,vstart                 integer                    not null
  293.    )
  294. go
  295.  
  296. /****
  297. create unique Clustered
  298.    index    idx1
  299.    on       spt_fallback_usg
  300.       (
  301.        xserver_name
  302.       ,dbid
  303.       ,lstart
  304.       )
  305. ****/
  306. go
  307.  
  308.  
  309. ------------------------------------------------------------------
  310. ------------------------------------------------------------------
  311.  
  312. raiserror('Granting on spt_ tables ...',0,1)
  313. go
  314.  
  315. grant select on spt_values  to public
  316. grant select on spt_monitor to public
  317.  
  318. grant select on spt_fallback_db to public
  319. grant select on spt_fallback_dev to public
  320. grant select on spt_fallback_usg to public
  321. go
  322.  
  323.  
  324.  
  325. ------------------------------------------------------------------
  326. ------------------------------------------------------------------
  327.  
  328.  
  329. raiserror('Now inserting one row into table spt_monitor',0,1)
  330. go
  331.  
  332. insert into spt_monitor
  333.     select
  334.     lastrun = getdate(),
  335.     cpu_busy = @@cpu_busy,
  336.     io_busy = @@io_busy,
  337.     idle = @@idle,
  338.     pack_received = @@pack_received,
  339.     pack_sent = @@pack_sent,
  340.     connections = @@connections,
  341.     pack_errors = @@packet_errors,
  342.     total_read = @@total_read,
  343.     total_write = @@total_write,
  344.     total_errors = @@total_errors
  345. go
  346.  
  347.  
  348.  
  349. -- Caution, 'Z' is used by sp_helpsort, though no 'Z' rows are inserted by this file.
  350.  
  351. print ''
  352. print 'Now Inserting rows into table spt_values ...'
  353. go
  354.  
  355. print ''
  356. print 'Adding status bit descriptions for sysservers (''A'').'
  357. go
  358. insert into spt_values (name, number, type)
  359.     values ('SYSSERVERS TYPES', -1, 'A')
  360. insert into spt_values (name, number, type)
  361.     values ('rpc', 1, 'A')
  362. insert into spt_values (name, number, type)
  363.     values ('pub', 2, 'A')
  364. insert into spt_values (name, number, type)
  365.     values ('sub', 4, 'A')
  366. insert into spt_values (name, number, type)
  367.     values ('dist', 8, 'A')
  368. insert into spt_values (name, number, type)
  369.     values ('dpub', 16, 'A')
  370. insert into spt_values (name, number, type)
  371.     values ('dsn', 32, 'A')
  372. insert into spt_values (name, number, type)
  373.     values ('fallback', 64, 'A')
  374. go
  375.  
  376. print ''
  377. print 'Adding translations for ''yes'', ''no'', etc.'
  378. go
  379. insert spt_values (name, number, type)
  380.     values ('YES OR NO', -1, 'B')
  381. insert spt_values (name, number, type)
  382.     values ('no', 0, 'B')
  383. insert spt_values (name, number, type)
  384.     values ('yes', 1, 'B')
  385. insert spt_values (name, number, type)
  386.     values ('none', 2, 'B')
  387. go
  388.  
  389.  
  390. print ''
  391. print 'Adding configuration options...'
  392. go
  393. insert spt_values(name, number, type)
  394.         values ('CONFIGURATION OPTIONS', -1, 'C') -- 1=Dynamic, 2=Advanced
  395.  
  396. insert spt_values(name, number, type, low, high,status)
  397.     values ('recovery interval', 101, 'C', 1, 32767 ,1)
  398.  
  399. insert spt_values(name, number, type, low, high,status)
  400.     values ('allow updates', 102, 'C', 0, 1 ,1)
  401.  
  402. insert spt_values(name, number, type, low, high,status)
  403.     values ('user connections', 103, 'C', 5, @@max_connections ,0)
  404.  
  405. insert spt_values(name, number, type, low, high,status)
  406.     values ('memory', 104, 'C', 2800, 1048576 ,0)
  407.  
  408. insert spt_values(name, number, type, low, high,status)
  409.     values ('open databases', 105, 'C', 5, 32767 ,0)
  410.  
  411. insert spt_values(name, number, type, low, high,status)
  412.     values ('locks', 106, 'C', 5000, 2147483647 ,0)
  413.  
  414. insert spt_values(name, number, type, low, high,status)
  415.     values ('open objects', 107, 'C', 100, 2147483647 ,0)
  416.  
  417. insert spt_values(name, number, type, low, high,status)
  418.     values ('procedure cache', 108, 'C', 1, 99 ,0)
  419.  
  420. insert spt_values(name, number, type, low, high,status)
  421.     values ('fill factor', 109, 'C', 0, 100 ,0)
  422.  
  423. insert spt_values(name, number, type, low, high,status)
  424.     values ('database size', 111, 'C', 2, 10000 ,0)
  425.  
  426. insert spt_values(name, number, type, low, high,status)
  427.     values ('media retention', 112, 'C', 0, 365 ,0)
  428.  
  429. insert spt_values(name, number, type, low, high,status)
  430.     values ('recovery flags', 113, 'C', 0, 1 ,0)
  431.  
  432. insert spt_values(name, number, type, low, high,status)
  433.     values ('nested triggers', 115, 'C', 0, 1 ,1)
  434.  
  435. insert spt_values(name, number, type, low, high,status)
  436.     values ('remote access', 117, 'C', 0, 1 ,0)
  437.  
  438. insert spt_values(name, number, type, low, high,status)
  439.     values ('default language', 124, 'C', 0, 9999 ,1)
  440.  
  441. insert spt_values(name, number, type, low, high,status)
  442.     values ('language in cache', 125, 'C', 3, 100 ,0)
  443.  
  444.  
  445. insert spt_values (name, number, type, low,high,status)
  446.     values ('tempdb in ram (MB)', 501, 'C', 0, 2044 ,0)
  447.  
  448. insert spt_values(name, number, type, low, high,status)
  449.     values ('max async IO', 502, 'C', 1, 255 ,0)
  450.  
  451. insert into spt_values(name, number, type, low, high,status)
  452.     values ('max worker threads', 503, 'C', 10, 1024 ,1)
  453.  
  454. insert spt_values(name, number, type, low, high,status)
  455.     values ('network packet size', 505, 'C', 512, 32767 ,1)
  456.  
  457. insert into spt_values(name, number, type, low, high,status)
  458.     values ('RA worker threads', 508, 'C', 0, 255 ,0)
  459.  
  460. insert spt_values(name, number, type, low, high,status)
  461.     values ('show advanced options', 518, 'C', 0, 1 ,1)
  462.  
  463. insert into spt_values(name, number, type, low, high,status)
  464.     values ('LE threshold percent', 521, 'C', 1, 100 ,1)
  465.  
  466. insert into spt_values(name, number, type, low, high,status)
  467.     values ('LE threshold maximum', 523, 'C', 2, 500000 ,1)
  468.  
  469.  
  470. insert into spt_values(name, number, type, low, high,status)
  471.     values ('backup threads', 540, 'C', 0, 32 ,0)
  472.  
  473. insert into spt_values(name, number, type, low, high,status)
  474.     values ('backup buffer size', 541, 'C', 1, 10 ,1)
  475.  
  476.  
  477. insert into spt_values (name ,number ,type ,low ,high ,status)
  478.     values ('remote proc trans', 542, 'C', 0, 1, 0)
  479.  
  480. insert into spt_values (name ,number ,type ,low ,high ,status)
  481.     values ('remote conn timeout', 543, 'C', -1, 32767, 0)
  482.  
  483.  
  484.  
  485. insert into spt_values (name ,number ,type ,low ,high ,status)
  486.     values ('time slice', 1110, 'C', 50, 1000, 3)
  487.  
  488. insert into spt_values (name ,number ,type ,low ,high ,status)
  489.     values ('remote sites', 1119, 'C', 0, 256, 2)
  490.  
  491.  
  492.  
  493. insert spt_values (name, number, type, low, high,status)
  494.     values ('default sortorder id', 1123, 'C', 0, 255 ,2)
  495.  
  496. insert spt_values(name, number, type, low, high,status)
  497.     values ('hash buckets', 1504, 'C', 4999, 265003 ,2)
  498.  
  499. insert spt_values(name, number, type, low, high,status)
  500.     values ('sort pages', 1505, 'C', 64, 511 ,3)
  501.  
  502. insert spt_values(name, number, type, low, high,status)
  503.     values ('max lazywrite IO', 1506, 'C', 1, 255 ,3)
  504.  
  505.  
  506. insert into spt_values(name, number, type, low, high,status)
  507.     values ('RA slots per thread', 1509, 'C', 1, 255 ,2)
  508.  
  509. insert into spt_values(name, number, type, low, high,status)
  510.     values ('RA pre-fetches', 1510, 'C', 1, 1000 ,3)
  511.  
  512. insert into spt_values(name, number, type, low, high,status)
  513.     values ('RA delay', 1511, 'C', 0, 500 ,3)
  514.  
  515. insert into spt_values(name, number, type, low, high,status)
  516.     values ('RA cache miss limit', 1512, 'C', 1, 255 ,3)
  517.  
  518. insert into spt_values(name, number, type, low, high,status)
  519.     values ('RA cache hit limit', 1513, 'C', 1, 255 ,3)
  520.  
  521.  
  522. insert spt_values(name, number, type, low, high,status)
  523.     values ('spin counter', 1514, 'C', 1, 2147483647 ,3)
  524.  
  525. insert spt_values(name, number, type, low, high,status)
  526.     values ('free buffers', 1515, 'C', 20, 524288 ,3)
  527.  
  528. insert spt_values(name, number, type, low, high,status)
  529.     values ('SMP concurrency', 1516, 'C', -1, 64 ,2)
  530.  
  531. insert spt_values(name, number, type, low, high,status)
  532.     values ('priority boost', 1517, 'C', 0, 1 ,2)
  533.  
  534. insert spt_values(name, number, type, low, high,status)
  535.     values ('remote login timeout', 1519, 'C', 0, 2147483647 ,3)
  536.  
  537. insert spt_values(name, number, type, low, high,status)
  538.     values ('remote query timeout', 1520, 'C', 0, 2147483647 ,3)
  539.  
  540.  
  541. insert into spt_values(name, number, type, low, high,status)
  542.     values ('LE threshold minimum', 1522, 'C', 2, 500000 ,3)
  543.  
  544. insert into spt_values(name, number, type, low, high,status)
  545.     values ('logwrite sleep (ms)', 1530, 'C', -1, 500 ,1)
  546.  
  547. insert into spt_values(name, number, type, low, high,status)
  548.     values ('cursor threshold', 1531, 'C', -1, 2147483647 ,3)
  549.  
  550.  
  551. insert spt_values(name, number, type, low, high,status)
  552.     values ('set working set size', 1532, 'C', 0, 1 ,2)
  553.  
  554. insert spt_values(name, number, type, low, high,status)
  555.     values ('resource timeout', 1533, 'C', 5, 2147483647 ,3)
  556.  
  557. insert spt_values(name, number, type, low, high,status)
  558.     values ('user options'  --Most on/off style SET options
  559.           ,1534, 'C', 0
  560.           ,4095 ,1)  --Max is 0xfff=4095 (except for incompatibilities!)
  561.  
  562. insert spt_values(name, number, type, low, high,status)
  563.     values ('affinity mask', 1535, 'C', 0, 2147483647, 2)
  564.  
  565. insert spt_values(name, number, type, low, high,status)
  566.     values ('max text repl size', 1536, 'C', 0, 2147483647, 1)
  567. go
  568.  
  569.  
  570. print ''
  571. print 'Adding database status bits.'
  572. go
  573. /*
  574. **  If you add a bit here make sure you add the value to the value
  575. **    of the ALL SETTABLE option if it is settable with sp_dboption.
  576. */
  577.  
  578. insert spt_values (name, number, type)
  579.     values ('DATABASE STATUS', -1, 'D')
  580. insert spt_values (name, number, type)
  581.     values ('select into/bulkcopy', 4, 'D')
  582. insert spt_values (name, number, type)
  583.     values ('trunc. log on chkpt.', 8, 'D')
  584. insert spt_values (name, number, type)
  585.     values ('no chkpt on recovery', 16, 'D')
  586. insert spt_values (name, number, type)
  587.     values ('loading', 32, 'D')  --Had been "don't recover".
  588. insert spt_values (name, number, type)
  589.     values ('pre recovery', 64, 'D')
  590. insert spt_values (name, number, type)
  591.     values ('recovering', 128, 'D')
  592. insert spt_values (name, number, type)
  593.     values ('not recovered', 256, 'D')  --suspect
  594. insert into spt_values(name, number, type, low, high)
  595.     values ('offline', 512, 'D', 0, 1)
  596. insert spt_values (name, number, type)
  597.     values ('read only', 1024, 'D')
  598. insert spt_values (name, number, type)
  599.     values ('dbo use only', 2048, 'D')
  600. insert spt_values (name, number, type)
  601.     values ('single user', 4096, 'D')
  602. insert spt_values (name, number, type)
  603.     values ('ANSI null default', 16384, 'D')
  604. insert spt_values (name, number, type)
  605.     values ('emergency mode', 32768, 'D')
  606.  
  607. /* This bit comes from sysdatabases.category not sysdatabases.status. */
  608. insert spt_values (name, number, type)
  609.     values ('published', 65536, 'D')
  610. insert spt_values (name, number, type)
  611.     values ('subscribed', 131072, 'D')
  612.  
  613. /* Sum of bits of all settable options, update when adding such options
  614. ** or modifying existing options to be settable. */
  615. insert spt_values (name, number, type)
  616.     values ('ALL SETTABLE OPTIONS', 220700, 'D')
  617. go
  618.  
  619.  
  620.  
  621. print 'Add release/version data, re  sysdatabases.version  ...'
  622. go
  623. insert into spt_values (name ,number ,type,low,high)
  624.     values ('SYSDATABASES.VERSION', -1, 'DBV',-1,-1) --dbcc getvalue('current_version')
  625. insert into spt_values (name ,number ,type,low,high)
  626.     values ('4.2' ,199307 ,'DBV',1,1)  --WinNT version
  627. insert into spt_values (name ,number ,type,low,high)
  628.     values ('6.0' ,199506 ,'DBV',400,406) --Betas thru Release range was 400-406.
  629. declare @sysdbver int
  630. dbcc getvalue('current_version')
  631. select @sysdbver = @@error
  632. insert into spt_values (name ,number ,type,low,high)
  633.     values ('6.5' ,199604 ,'DBV',407,408) --,@sysdbver)
  634. go
  635.  
  636.  
  637.  
  638. print ''
  639. print 'Setting machine type.'
  640. go
  641. /*
  642. **  Set the machine type
  643. **  spt_values.low is the number of bytes in a page for the
  644. **  particular machine.
  645. */
  646. insert spt_values (name, number, type, low)
  647.     values ('SQLSERVER HOST TYPE', -1, 'E', 0)
  648. go
  649.  
  650. print ''
  651. print 'Adding platform specific entries.'
  652. go
  653. /*
  654. **  Set the platform specific entries.
  655. **  spt_values.low is the number of bytes in a page.
  656. */
  657. insert into spt_values (name, number, type, low)
  658.     values ('WINDOWS/NT', 1, 'E', 2048)
  659.  
  660. /* Value to set and clear the high bit for int datatypes for os/2.
  661. ** Would like to enter -2,147,483,648 to avoid byte order issues, but
  662. ** the server won't take it, even in exponential notation.
  663. */
  664. insert into spt_values (name, number, type, low)
  665.     values ('int high bit', 2, 'E', 0x80000000)
  666.  
  667. /* Value which gives the byte position of the high byte for int datatypes for
  668. ** os/2.  This value was changed from 4 (the usual Intel 80x86 order) to 1
  669. ** when binary convert routines were changed to reverse the byte order.  So
  670. ** this value is accurate ONLY when ints are converted to binary datatype.
  671. */
  672. insert into spt_values (name, number, type, low)
  673.     values ('int4 high byte', 3, 'E', 1)
  674. go
  675.  
  676. print ''
  677. print 'Adding status bit descriptions for sysremotelogins.'
  678. go
  679. insert spt_values (name, number, type)
  680.     values ('SYSREMOTELOGINS TYPES', -1, 'F')
  681. insert spt_values (name, number, type)
  682.     values ('', 0, 'F')
  683. insert spt_values (name, number, type)
  684.     values ('trusted', 1, 'F')
  685. go
  686.  
  687. insert spt_values (name, number, type)
  688.     values ('GENERAL MISC. STRINGS', -1, 'G')
  689. insert spt_values (name, number, type)
  690.     values ('SQL Server Internal Table', 0, 'G')
  691. go
  692.  
  693. print ''
  694. print 'Adding descriptions for status bits in sysindexes.'
  695. go
  696. insert spt_values (name, number, type)
  697.     values ('INDEX TYPES', -1, 'I')
  698. insert spt_values (name, number, type)
  699.     values ('nonclustered', 0, 'I')
  700. insert spt_values (name, number, type)
  701.     values ('ignore duplicate keys', 1, 'I')
  702. insert spt_values (name, number, type)
  703.     values ('unique', 2, 'I')
  704. insert spt_values (name, number, type)
  705.     values ('ignore duplicate rows', 4, 'I')
  706. insert spt_values (name, number, type)
  707.     values ('clustered', 16, 'I')
  708. insert spt_values (name, number, type)
  709.     values ('allow duplicate rows', 64, 'I')
  710. go
  711.  
  712. print ''
  713. print 'Adding values for referential integrity.'
  714. go
  715. insert into spt_values (name, number, type, low, high)
  716.     values ('primary key', 2048, 'I', 0, 1)
  717. insert into spt_values (name, number, type, low, high)
  718.     values ('unique key', 4096, 'I', 0, 1)
  719. go
  720.  
  721. print ''
  722. print 'Adding listing of physical types that are compatible.'
  723. go
  724. insert spt_values (name, number, type)
  725.     values ('COMPATIBLE TYPES', -1, 'J')
  726. insert spt_values (name, number, low, type)
  727.     values ('binary', 1, 45, 'J')
  728. insert spt_values (name, number, low, type)
  729.     values ('varbinary', 1, 37, 'J')
  730. insert spt_values (name, number, low, type)
  731.     values ('bit', 2, 50, 'J')
  732. insert spt_values (name, number, low, type)
  733.     values ('char', 3, 47, 'J')
  734. insert spt_values (name, number, low, type)
  735.     values ('varchar', 3, 39, 'J')
  736. insert spt_values (name, number, low, type)
  737.     values ('datetime', 4, 61, 'J')
  738. insert spt_values (name, number, low, type)
  739.     values ('datetimn', 4, 111, 'J')
  740. insert spt_values (name, number, low, type)
  741.     values ('smalldatetime', 4, 58, 'J')
  742. insert spt_values (name, number, low, type)
  743.     values ('float', 5, 62, 'J')
  744. insert spt_values (name, number, low, type)
  745.     values ('floatn', 5, 109, 'J')
  746. insert spt_values (name, number, low, type)
  747.     values ('real', 5, 59, 'J')
  748. insert spt_values (name, number, low, type)
  749.     values ('int', 6, 56, 'J')
  750. insert spt_values (name, number, low, type)
  751.     values ('intn', 6, 38, 'J')
  752. insert spt_values (name, number, low, type)
  753.     values ('smallint', 6, 52, 'J')
  754. insert spt_values (name, number, low, type)
  755.     values ('tinyint', 6, 48, 'J')
  756. insert spt_values (name, number, low, type)
  757.     values ('money', 7, 60, 'J')
  758. insert spt_values (name, number, low, type)
  759.     values ('moneyn', 7, 110, 'J')
  760. insert spt_values (name, number, low, type)
  761.     values ('smallmoney', 7, 122, 'J')
  762. go
  763.  
  764. print ''
  765. print 'Adding bit description for syskeys.type.'
  766. go
  767. insert spt_values (name, number, type)
  768.     values ('SYSKEYS TYPES', -1, 'K')
  769. insert spt_values (name, number, type)
  770.     values ('primary', 1, 'K')
  771. insert spt_values (name, number, type)
  772.     values ('foreign', 2, 'K')
  773. insert spt_values (name, number, type)
  774.     values ('common', 3, 'K')
  775. go
  776.  
  777. print ''
  778. print 'Adding values for syslocks.type'
  779. go
  780. insert spt_values(name, number, type)
  781.   values ('LOCK TYPES', -1, 'L')
  782. insert spt_values(name, number, type)
  783.   values ('Ex_table', 1, 'L')
  784. insert spt_values(name, number, type)
  785.   values ('Sh_table', 2, 'L')
  786. insert spt_values(name, number, type)
  787.   values ('Ex_intent', 3, 'L')
  788. insert spt_values(name, number, type)
  789.   values ('Sh_intent', 4, 'L')
  790. insert spt_values(name, number, type)
  791.   values ('Ex_page', 5, 'L')
  792. insert spt_values(name, number, type)
  793.   values ('Sh_page', 6, 'L')
  794. insert spt_values(name, number, type)
  795.   values ('Update_page', 7, 'L')
  796. insert spt_values(name, number, type)
  797.   values ('Ex_extent', 8, 'L')
  798. insert spt_values(name, number, type)
  799.   values ('Update_extent', 9, 'L')
  800. insert spt_values(name, number, type)
  801.   values ('ShTab_ExIntent', 10, 'L')
  802. insert spt_values(name, number, type)
  803.   values ('Next_extent', 11, 'L')
  804. insert spt_values(name, number, type)
  805.   values ('Prev_extent', 12, 'L')
  806. insert spt_values(name, number, type)
  807.   values ('Insert_page', 13, 'L')
  808. insert spt_values(name, number, type)
  809.   values ('Link_page', 14, 'L')
  810. insert spt_values(name, number, type)
  811.   values ('Ex_table-blk', 256+1, 'L')
  812. insert spt_values(name, number, type)
  813.   values ('Sh_table-blk', 256+2, 'L')
  814. insert spt_values(name, number, type)
  815.   values ('Ex_intent-blk', 256+3, 'L')
  816. insert spt_values(name, number, type)
  817.   values ('Sh_intent-blk', 256+4, 'L')
  818. insert spt_values(name, number, type)
  819.   values ('Ex_page-blk', 256+5, 'L')
  820. insert spt_values(name, number, type)
  821.   values ('Sh_page-blk', 256+6, 'L')
  822. insert spt_values(name, number, type)
  823.   values ('Update_page-blk', 256+7, 'L')
  824. insert spt_values(name, number, type)
  825.   values ('Ex_extent-blk', 256+8, 'L')
  826. insert spt_values(name, number, type)
  827.   values ('Update_extent-blk', 256+9, 'L')
  828. insert spt_values(name, number, type)
  829.   values ('ShTab_ExIntent-blk', 256+10, 'L')
  830. insert spt_values(name, number, type)
  831.   values ('Next_extent-blk', 256+11, 'L')
  832. insert spt_values(name, number, type)
  833.   values ('Prev_extent-blk', 256+12, 'L')
  834. insert spt_values(name, number, type)
  835.   values ('Insert_page-blk', 256+13, 'L')
  836. insert spt_values(name, number, type)
  837.   values ('Link_page-blk', 256+14, 'L')
  838. go
  839.  
  840. /*
  841. ******************************************
  842. StarFighter Lock Description Strings
  843. ******************************************
  844. */
  845.  
  846. insert spt_values(name, number, type)
  847.   values ('SF LOCK TYPES', -1, 'SFL')
  848. insert spt_values(name, number, type)
  849.   values ('Extent Lock - Exclusive', 8, 'SFL')
  850. insert spt_values(name, number, type)
  851.   values ('Extent Lock - Update', 9, 'SFL')
  852. insert spt_values(name, number, type)
  853.   values ('Extent Lock - Next', 11, 'SFL')
  854. insert spt_values(name, number, type)
  855.   values ('Extent Lock - Previous', 12, 'SFL')
  856. go
  857.  
  858. print ''
  859. print 'Adding descriptions for object types.'
  860. go
  861. /*
  862. **  These values define the object type.  The number made from the low
  863. **  4 bits in sysobjects.sysstats indicates the type of object.
  864. */
  865. insert spt_values (name, number, type)
  866.     values ('OBJECT TYPES', -1, 'O')
  867. insert spt_values (name, number, type)
  868.     values ('system table', 1, 'O')
  869. insert spt_values (name, number, type)
  870.     values ('view', 2, 'O')
  871. insert spt_values (name, number, type)
  872.     values ('user table', 3, 'O')
  873. insert spt_values (name, number, type)
  874.     values ('stored procedure',4, 'O')
  875. /* no number 5 */
  876. insert spt_values (name, number, type)
  877.     values ('default', 6, 'O')
  878. insert spt_values (name, number, type)
  879.     values ('rule', 7, 'O')
  880. insert spt_values (name, number, type)
  881.     values ('trigger', 8, 'O')
  882. insert spt_values (name, number, type)
  883.     values ('replication filter stored procedure', 12, 'O')
  884. go
  885.  
  886.  
  887. print ''
  888. print 'Adding bit position information  ''P''  (helpful with sysprotects.columns).'
  889. go
  890.  
  891. insert spt_values(low, high, number, type) values (1, 1, 0, 'P')
  892. /*
  893. **insert spt_values(name, number, type)
  894. **    values ('BIT POSITIONS', -1, 'P')
  895. **go
  896. */
  897. insert spt_values(low, high, number, type) values (1, 2, 1, 'P')
  898. insert spt_values(low, high, number, type) values (1, 4, 2, 'P')
  899. insert spt_values(low, high, number, type) values (1, 8, 3, 'P')
  900. insert spt_values(low, high, number, type) values (1, 16, 4, 'P')
  901. insert spt_values(low, high, number, type) values (1, 32, 5, 'P')
  902. insert spt_values(low, high, number, type) values (1, 64, 6, 'P')
  903. insert spt_values(low, high, number, type) values (1, 128, 7, 'P')
  904. go
  905.  
  906. /* 8 - 15 */
  907. insert spt_values(low, high, number, type)
  908. select
  909.     (select max(low) from spt_values where type = 'P' and number
  910.     between 0 and 7) + 1 + (number / 8),high,
  911.     number + 1 + (select max(number) from spt_values where type = 'P'
  912.     and number between 0 and 7), 'P'
  913.     from spt_values
  914.     where type = 'P' and number between 0 and 7
  915. go
  916. /* 16 - 31 */
  917. insert spt_values(low, high, number, type)
  918. select
  919.     (select max(low) from spt_values where type = 'P' and number
  920.     between 0 and 15) + 1 + (number / 8), high, number + 1 +
  921.     (select max(number) from spt_values where type = 'P' and number
  922.     between 0 and 15), 'P'
  923.     from spt_values
  924.     where type = 'P' and number between 0 and 15
  925. go
  926. /* 32 - 63 */
  927. insert spt_values(low, high, number, type)
  928. select
  929.     (select max(low) from spt_values where type = 'P' and number
  930.     between 0 and 63) + 1 + (number / 8), high, number + 1 +
  931.     (select max(number) from spt_values where type = 'P' and number
  932.     between 0 and 63), 'P'
  933.     from spt_values
  934.     where type = 'P' and number between 0 and 63
  935. go
  936. /* 64 - 127 */
  937. insert spt_values(low, high, number, type)
  938. select
  939.     (select max(low) from spt_values where type = 'P' and number
  940.     between 0 and 127) + 1 + (number / 8), high, number + 1 +
  941.     (select max(number) from spt_values where type = 'P' and number
  942.     between 0 and 127), 'P'
  943.     from spt_values
  944.     where type = 'P' and number between 0 and 127
  945. go
  946. /* 128 - 255 */
  947. insert spt_values(low, high, number, type)
  948. select
  949.     (select max(low) from spt_values where type = 'P' and number
  950.     between 0 and 127) + 1 + (number / 8), high, number + 1 +
  951.     (select max(number) from spt_values where type = 'P' and number
  952.     between 0 and 127), 'P'
  953.     from spt_values
  954.     where type = 'P' and number between 0 and 127
  955. go
  956.  
  957.  
  958. print ''
  959. print 'Adding bit descriptions for sysobjects.userstat (''R'').'
  960. go
  961. /*
  962. **  These values translate the object type's userstat bits.  If the high
  963. **  bit is set for a sproc, then it's a report.
  964. */
  965. insert spt_values (name, number, type)
  966.     values ('REPORT TYPES', -1, 'R')
  967. insert spt_values (name, number, type)
  968.     values ('', 0, 'R')
  969. insert spt_values (name, number, type)
  970.     values (' (rpt)', -32768, 'R')
  971. go
  972.  
  973. print ''
  974. print 'Adding descriptions for sysusages.segmap.'
  975. go
  976. insert into spt_values (name, type, number)
  977.     values ('SYSUSAGES SEGMAP', 'S', -1)
  978. insert into spt_values (name, type, number)
  979.     values ('data only', 'S', 0)
  980. insert into spt_values (name, type, number)
  981.     values ('data only', 'S', 1)
  982. insert into spt_values (name, type, number)
  983.     values ('data only', 'S', 2)
  984. insert into spt_values (name, type, number)
  985.     values ('data only', 'S', 3)
  986. insert into spt_values (name, type, number)
  987.     values ('log only', 'S', 4)
  988. insert into spt_values (name, type, number)
  989.     values ('data only', 'S', 5)
  990. insert into spt_values (name, type, number)
  991.     values ('data only', 'S', 6)
  992. insert into spt_values (name, type, number)
  993.     values ('data and log', 'S', 7)
  994. go
  995.  
  996.  
  997. raiserror('Adding type=''SOP'' rows for SET Options status info.   See sp_help_setopts, @@options, and config=1534 (''user options'').',0,1)
  998. go
  999. --status&1=1 means configurable via 'user options'.
  1000. insert into spt_values (name ,number ,type ,status) values
  1001.       ('@@OPTIONS' ,-1 ,'SOP' ,0)
  1002. go
  1003. insert into spt_values (name ,number ,type ,status) values
  1004.       ('disable_def_cnst_check'  ,1 ,'SOP' ,1)
  1005.  
  1006. insert into spt_values (name ,number ,type ,status) values
  1007.       ('implicit_transactions'   ,2 ,'SOP' ,1)
  1008.  
  1009. insert into spt_values (name ,number ,type ,status) values
  1010.       ('cursor_close_on_commit'  ,4 ,'SOP' ,1)
  1011.  
  1012. insert into spt_values (name ,number ,type ,status) values
  1013.       ('ansi_warnings'           ,8 ,'SOP' ,1)
  1014.  
  1015. insert into spt_values (name ,number ,type ,status) values
  1016.       ('ansi_padding'            ,16 ,'SOP' ,1)
  1017.  
  1018. insert into spt_values (name ,number ,type ,status) values
  1019.       ('ansi_nulls'              ,32 ,'SOP' ,1)
  1020.  
  1021. insert into spt_values (name ,number ,type ,status) values
  1022.       ('arithabort'              ,64 ,'SOP' ,1)
  1023.  
  1024. insert into spt_values (name ,number ,type ,status) values
  1025.       ('arithignore'             ,128 ,'SOP' ,1)
  1026.  
  1027. insert into spt_values (name ,number ,type ,status) values
  1028.       ('quoted_identifier'       ,256 ,'SOP' ,1)
  1029.  
  1030. insert into spt_values (name ,number ,type ,status) values
  1031.       ('nocount'                 ,512 ,'SOP' ,1)
  1032.  
  1033. --Mutually exclusive when ON.
  1034. insert into spt_values (name ,number ,type ,status) values
  1035.       ('ansi_null_dflt_on'       ,1024 ,'SOP' ,1)
  1036. insert into spt_values (name ,number ,type ,status) values
  1037.       ('ansi_null_dflt_off'      ,2048 ,'SOP' ,1)
  1038. go
  1039.  
  1040.  
  1041. print ''
  1042. print 'Adding sysprotects.action AND protecttype values...'
  1043. go
  1044. insert spt_values(name, number, type)
  1045.   values ('SYSPROTECTS.ACTION', -1, 'T')
  1046. insert spt_values(name, number, type)
  1047.   values ('References', 26, 'T')
  1048. insert spt_values(name, number, type)
  1049.   values ('Select', 193, 'T')          ----action
  1050. insert spt_values(name, number, type)
  1051.   values ('Insert', 195, 'T')  --Covers BCPin and LoadTable.
  1052. insert spt_values(name, number, type)
  1053.   values ('Delete', 196, 'T')
  1054. insert spt_values(name, number, type)
  1055.   values ('Update', 197, 'T')
  1056. insert spt_values(name, number, type)
  1057.   values ('Create Table', 198, 'T')
  1058. insert spt_values(name, number, type)
  1059.   values ('Create Database', 203, 'T')
  1060.  
  1061. insert spt_values(name, number, type)
  1062.   values ('Grant_WGO', 204, 'T')
  1063. insert spt_values(name, number, type)
  1064.   values ('Grant', 205, 'T')           ----protecttype
  1065. insert spt_values(name, number, type)
  1066.   values ('Revoke', 206, 'T')
  1067.  
  1068. insert spt_values(name, number, type)
  1069.   values ('Create View', 207, 'T')
  1070. insert spt_values(name, number, type)
  1071.   values ('Create Procedure', 222, 'T')
  1072. insert spt_values(name, number, type)
  1073.   values ('Execute', 224, 'T')
  1074. insert spt_values(name, number, type)
  1075.   values ('Dump Database', 228, 'T')
  1076. insert spt_values(name, number, type)
  1077.   values ('Create Default', 233, 'T')
  1078. insert spt_values(name, number, type)
  1079.   values ('Dump Transaction', 235, 'T')
  1080. insert spt_values(name, number, type)
  1081.   values ('Create Rule', 236, 'T')
  1082.  
  1083. go
  1084.  
  1085.  
  1086. print ''  -- Table Options (In 6.5 see sp_tableoption)
  1087. print 'Adding type=''TBO'' row for TaBle Options.'
  1088. go
  1089. insert spt_values (name ,number ,type ,low ,high ,status)
  1090.     values ('TableOptions' ,0 ,'TBO' ,0 ,1 ,0) -- sysobj.userstat/.sysstat
  1091. insert spt_values (name ,number ,type ,low ,high ,status)
  1092.     values ('insert row lock' ,1 ,'TBO' ,0 ,1 ,0) -- userstat
  1093. insert spt_values (name ,number ,type ,low ,high ,status)
  1094.     values ('table lock on bulk load' ,2 ,'TBO' ,0 ,1 ,0) -- userstat 6.5 SP1 new
  1095. insert spt_values (name ,number ,type ,low ,high ,status)
  1096.     values ('pintable' ,512 ,'TBO' ,0 ,1 ,0) -- sysstat 6.5 SP1 change
  1097.  
  1098. go
  1099.  
  1100.  
  1101. print ''
  1102. print 'Add bit description for sysdevices.status.'
  1103. go
  1104. insert spt_values (name, number, type)
  1105.     values ('SYSDEVICES STATUS', -1, 'V')
  1106. insert spt_values (name, number, type)
  1107.     values ('default disk', 1, 'V')
  1108. insert spt_values (name, number, type)
  1109.     values ('physical disk', 2, 'V')
  1110. insert spt_values (name, number, type)
  1111.     values ('logical disk', 4, 'V')
  1112. insert spt_values (name, number, type)
  1113.     values ('skip header', 8, 'V')
  1114. insert spt_values (name, number, type)
  1115.     values ('dump device', 16, 'V')
  1116. insert spt_values (name, number, type)
  1117.     values ('serial writes', 32, 'V')
  1118. insert spt_values (name, number, type)
  1119.     values ('device mirrored', 64, 'V')
  1120. insert spt_values (name, number, type)
  1121.     values ('reads mirrored', 128, 'V')
  1122. insert spt_values (name, number, type)
  1123.     values ('half-mirror only', 256, 'V')
  1124. insert spt_values (name, number, type)
  1125.     values ('mirror enabled', 512, 'V')
  1126. insert into spt_values(name, number, type, low, high)
  1127.     values ('read only', 4096, 'V', 0, 1)
  1128. insert into spt_values(name, number, type, low, high)
  1129.     values ('deferred', 8192, 'V', 0, 1)
  1130. go
  1131.  
  1132. update statistics spt_values
  1133. go
  1134.  
  1135. ------------------------------------------------------------------
  1136. go
  1137. exec sp_MS_upd_sysobj_category 2
  1138. go
  1139. ------------------------------------------------------------------
  1140.  
  1141. /********
  1142. if exists (select * from sysobjects where name = 'sp_configure'
  1143.             and sysstat & 0xf = 4)
  1144.     begin
  1145.         exec sp_configure 'allow updates',0
  1146.         reconfigure with override
  1147.     end
  1148. ********/
  1149. go
  1150.  
  1151. declare @vdt varchar(99)
  1152. select  @vdt = convert(varchar,getdate(),113)
  1153. raiserror('Finishing Install\SptValue.SQL at  %s',0,1,@vdt)
  1154. go
  1155.  
  1156. dump tran master with no_log
  1157. go
  1158. checkpoint
  1159. go
  1160. print 'End of .SQL file.'
  1161. go
  1162. -- -
  1163.  
  1164.