home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Internet Business Development Kit / PRODUCT_CD.iso / sqlsvr / alpha / u_tables.sql < prev    next >
Encoding:
Text File  |  1995-12-12  |  31.0 KB  |  1,017 lines

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