home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a063 / 4.img / SCRIPTS / INSTIPUB.SQL next >
Encoding:
Text File  |  1992-05-17  |  18.4 KB  |  624 lines

  1. /* $Header:   S:/DBMS/OS2/SCRIPTS/PVCS/INSTIPUB.SQV   5.1   09 Mar 1992 18:20:16   YUMEI  $ */
  2. /********************************************************************************/
  3. /* installinterpubs    28.1.1.1    12/20/90 */
  4. /* installinterpubs - script to install the international pubs database    1/3/90  */
  5. /********************************************************************************/
  6. /*******                                                                  *******/
  7. /*******CAUTION:  Do not edit this file with an editor like /usr/ucb/vi!! *******/
  8. /*******          It will strip off the 8th bit and you will no longer    *******/
  9. /*******          have any of the accented characters.                    *******/
  10. /*******                                                                  *******/
  11. /*******          If you have already begun to edit this file, you should *******/
  12. /*******          quit without saving (:q! in vi); otherwise, the data    *******/
  13. /*******          will not reflect any of the international characters.   *******/
  14. /*******                                                                  *******/
  15. /********************************************************************************/
  16. set nocount on
  17.  
  18. if exists (select * from master.dbo.sysdatabases
  19.         where name = "interpubs")
  20. begin
  21.     drop database interpubs
  22. end
  23. go
  24. print 'Creating the "interpubs" database'
  25. create database interpubs
  26. go
  27. use interpubs
  28. go
  29. if exists (select * from master.dbo.sysdatabases
  30.         where name = "interpubs")
  31. begin
  32.     execute sp_addtype id, "varchar(11)", "not null"
  33.     execute sp_addtype tid, "varchar(6)", "not null"
  34. end
  35. go
  36. if exists (select * from master.dbo.sysdatabases
  37.         where name = "interpubs")
  38. begin
  39.     create table authors
  40.     (au_id id,
  41.     au_lname varchar(40) not null,
  42.     au_fname varchar(20) not null,
  43.     phone char(14),
  44.     address varchar(40) null,
  45.     city varchar(20) null,
  46.     state char(2) null,
  47.     country varchar(12) null,
  48.     postalcode char(10) null)
  49. end
  50. go
  51. grant select on authors to public
  52. go
  53. if exists (select * from master.dbo.sysdatabases
  54.         where name = "interpubs")
  55. begin
  56.     create table titleauthor
  57.     (au_id id,
  58.     title_id tid,
  59.     au_ord tinyint null,
  60.     royaltyper int null)
  61. end
  62. go
  63. grant select on titleauthor to public
  64. go
  65. create unique clustered index taind
  66. on titleauthor (au_id, title_id)
  67. go
  68. create nonclustered index auidind
  69. on titleauthor (au_id)
  70. go
  71. create nonclustered index titleidind
  72. on titleauthor (title_id)
  73. go
  74. if exists (select * from master.dbo.sysdatabases
  75.         where name = "interpubs")
  76. begin
  77.     create table sales
  78.     (stor_id char(4),
  79.     ord_num varchar(20),
  80.     date datetime,
  81.     qty smallint,
  82.     payterms varchar(12),
  83.     title_id tid)
  84. end
  85. go
  86. grant select on sales to public
  87. go
  88. if exists (select * from master.dbo.sysdatabases
  89.         where name = "interpubs")
  90. begin
  91.     create table titles
  92.     (title_id tid,
  93.     title varchar(80) not null,
  94.     type char(12),
  95.     price money null,
  96.     advance money null,
  97.     royalty int null,
  98.     ytd_sales int null,
  99.     notes varchar(255) null,
  100.     pubdate datetime)
  101. end
  102. go
  103. grant select on titles to public
  104. go
  105. if exists (select * from master.dbo.sysdatabases
  106.         where name = "interpubs")
  107. begin
  108.     create table stores
  109.     (stor_id char(4),
  110.     stor_name varchar(40) null,
  111.     stor_address varchar(40) null,
  112.     city varchar(20) null,
  113.     state char(2) null,
  114.     country varchar(12) null,
  115.     postalcode char(10) null)
  116. end
  117. go
  118. grant select on stores to public
  119. go
  120. if exists (select * from master.dbo.sysdatabases
  121.         where name = "interpubs")
  122. begin
  123.     create table discounts
  124.     (discounttype   varchar(40) not null,
  125.     stor_id         char(4) null,
  126.     lowqty          smallint null,
  127.     highqty         smallint null,
  128.     discount        float)
  129. end
  130. go
  131. grant select on discounts to public
  132. go
  133. execute sp_primarykey titles, title_id
  134. execute sp_primarykey titleauthor, au_id, title_id
  135. execute sp_primarykey authors, au_id
  136. execute sp_primarykey sales, stor_id, title_id, ord_num
  137. execute sp_primarykey stores, stor_id
  138. execute sp_primarykey discounts, discounttype, stor_id  
  139. go
  140. execute sp_foreignkey titleauthor, titles, title_id
  141. execute sp_foreignkey titleauthor, authors, au_id
  142. execute sp_foreignkey sales, titles, title_id
  143. execute sp_foreignkey sales, stores, stor_id
  144. execute sp_foreignkey discounts, stores, stor_id
  145. go
  146. create unique clustered index auidind
  147. on authors (au_id)
  148. go
  149. create nonclustered index aunmind
  150. on authors (au_lname, au_fname)
  151. go
  152. create unique clustered index titleidind
  153. on titles (title_id)
  154. go
  155. create nonclustered index titleind
  156. on titles (title)
  157. go
  158. create nonclustered index titleidind
  159. on sales (title_id)
  160. go
  161. create default typedflt
  162. as "UNDECIDED"
  163. go
  164. sp_bindefault typedflt, "titles.type"
  165. go
  166. create default datedflt
  167. as getdate()
  168. go
  169. sp_bindefault datedflt, "titles.pubdate"
  170. go
  171. create default phonedflt
  172. as "UNKNOWN"
  173. go
  174. sp_bindefault phonedflt, "authors.phone"
  175. go
  176. insert authors
  177. values('409-56-7008', 'Bennet', 'Abraham',
  178. '415 658-9932', '6223 Bateman St.', 'Berkeley', 'CA', 'USA', '94703')
  179. go
  180. insert authors
  181. values ('213-46-8915', 'Green', 'Marjorie',
  182. '415 986-7020', '309 63rd St. #411', 'Oakland', 'CA', 'USA','94618')
  183. go
  184. insert authors
  185. values('238-95-7766', 'Carson', 'Cheryl',
  186. '415 548-7723', '589 Darwin Ln.', 'Berkeley', 'CA', 'USA', '94705')
  187. go
  188. insert authors
  189. values('998-72-3567', 'Ringer', 'Albert',
  190. '801 826-0752', '67 Seventh Ave.', 'Salt Lake City', 'UT', 'USA', '84152')
  191. go
  192. insert authors
  193. values('899-46-2035', 'Ringer', 'Anne',
  194. '801 826-0752', '67 Seventh Ave.', 'Salt Lake City', 'UT', 'USA', '84152')
  195. go
  196. insert authors
  197. values('020-83-5948', 'Dvblin', 'Alfred',
  198. '010 223 2455', '12, Goethestra_e', 'Berlin', 'Berlin','BRD','P-1124')
  199. go
  200. insert authors
  201. values('011-112-1211', 'D|rrenmatt','Friedrich',
  202. '011 255 29 24', '24, Schvnplatz','Bern','Bern','Schweiz','S-114')
  203. go
  204. insert authors
  205. values('018-913-9422', 'Bvll', 'Heinrich',
  206. '011 442 23 90', '18, Einsteinga_e', 'Bonn', 'Bonn', 'BRD', 'V-222')
  207. go
  208. insert authors 
  209. values('080-92-2323', 'Borchert', 'Wolfgang',
  210. '020 828 09 93', '24, T|ringenstra_e', 'Wien', 'Wien', 'Vsterreich', 'A-1253')
  211. go
  212. insert authors
  213. values('011-35-8631', 'Dutschke', 'Rudi',
  214. '399-09-8380', '811, Lindenstra_e', 'M|nchen', 'M|nchen','BRD', 'B-8263')
  215. go
  216. insert authors
  217. values('136-85-3857', 'Cisaire', 'Aimi',
  218. '010 244 38 95','8, Rue de la Campagne','Nice','Nice','France','N-1382')
  219. go
  220. insert authors
  221. values('852-22-3431', 'Ciline', 'Louis-Ferdinand',
  222. '010 344 24 28', '9, Avenue Foch', 'Paris', 'Paris', 'France', 'X-1124')
  223. go
  224. insert authors
  225. values('258-82-1314', 'Cendrars', 'Blaise',
  226. '023 392 29 40', '12, Rue de Gaulle', 'Lyons', 'Lyons', 'France', 'Y-1388')
  227. go
  228. insert authors
  229. values('010-08-1946', 'Livi-Strauss', 'Claude',
  230. '099 998 23 84', '10, Avenue Saint Martin', 'Paris', 'Paris', 'France', 'P-2832')
  231. go
  232. insert authors
  233. values('330-29-9328', 'Privost', 'Antoine-Frangois',
  234. '011 203 83 27', "82, Rue de l'Iglise", 'Nancy', 'Nancy', 'France', 'N-3289')
  235. go
  236. insert authors
  237. values('828-39-2382', 'Sigalen', 'Victor',
  238. '011 210 28 21', '104, Avenue Saint Michel', 'Nernier','Haute-Savoie', 'France', 'H-1383')
  239. go
  240. insert authors
  241. values('831-11-9825', 'Aymi', 'Marcel',
  242. '011 223 28 22', '112, Rue Micheline', 'Le Mans', 'Le Mans', 'France', 'A-1211')
  243. go
  244. insert authors
  245. values('030-23-1432', 'Arihs', 'Philippe',
  246. '012 822 28 02', '84, Rue Charpentier', 'Paris', 'Paris', 'France', 'P-8224')
  247. insert sales
  248. values('7066', 'QA7442.3', '09/13/85', 75, 'On invoice','PS2091')
  249. go
  250. insert sales
  251. values('7067', 'D4482', '09/14/85', 10, 'Net 60','PS2091')
  252. go
  253. insert sales
  254. values('7131', 'N914008', '09/14/85', 20, 'Net 30','PS2091')
  255. go
  256. insert sales
  257. values('7131', 'N914014', '09/14/85', 25, 'Net 30','MC3021')
  258. go
  259. insert sales
  260. values('8042', '423LL922', '09/14/85', 15, 'On invoice','MC3021')
  261. go
  262. insert sales
  263. values('8042', '423LL930', '09/14/85', 10, 'On invoice','BU1032')
  264. go
  265. insert sales
  266. values('6380', '722a', '09/13/85', 3, 'Net 60','PS2091')
  267. go
  268. insert sales
  269. values('6380', '6871', '09/14/85', 5, 'Net 60','BU1032')
  270. go
  271. insert sales 
  272. values('8042','P723', '03/11/88', 25, 'Net 30', 'BU1111')
  273. go
  274. insert sales 
  275. values('7896','X999', '02/21/88', 35, 'On invoice', 'BU2075')
  276. go
  277. insert sales 
  278. values('7896','QQ2299', '10/28/87', 15, 'Net 60', 'BU7832')
  279. go
  280. insert sales 
  281. values('7896','TQ456', '12/12/87', 10, 'Net 60', 'MC2222')
  282. go
  283. insert sales 
  284. values('8042','QA879.1', '5/22/87', 30, 'Net 30', 'PC1035')
  285. go
  286. insert sales 
  287. values('7066','A2976', '5/24/87', 50, 'Net 30', 'PC8888')
  288. go
  289. insert sales 
  290. values('7131','P3087a', '5/29/87', 20, 'Net 60', 'PS1372')
  291. go
  292. insert sales 
  293. values('7131','P3087a', '5/29/87', 25, 'Net 60', 'PS2106')
  294. go
  295. insert sales 
  296. values('7131','P3087a', '5/29/87', 15, 'Net 60', 'PS3333')
  297. go
  298. insert sales 
  299. values('7131','P3087a', '5/29/87', 25, 'Net 60', 'PS7777')
  300. go
  301. insert sales 
  302. values('7067','P2121', '6/15/87', 40, 'Net 30', 'TC3218')
  303. go
  304. insert sales 
  305. values('7067','P2121', '6/15/87', 20, 'Net 30', 'TC4203')
  306. go
  307. insert sales 
  308. values('7067','P2121', '6/15/87', 20, 'Net 30', 'TC7777')
  309. go
  310. insert sales
  311. values('7067','P2123', '6/20/87', 20, 'Net 30', 'HI1789')
  312. go
  313. insert sales
  314. values('7067','P2123', '6/20/87', 10, 'Net 30', 'HI1897')
  315. go
  316. insert sales
  317. values('7067','P2123', '6/20/87', 5, 'Net 30', 'HI1983')
  318. go
  319. insert sales
  320. values('7067','P2123', '6/20/87', 50, 'Net 30', 'PH8103')
  321. go
  322. insert sales
  323. values('8042', '483LL821', '09/14/87', 10, 'On invoice','MY1012')
  324. go
  325. insert sales
  326. values('8042', '483LL821', '09/14/87', 20, 'On invoice','MY1011')
  327. go
  328. insert sales
  329. values('8042', '483LL821', '09/14/87', 20, 'On invoice','MY8332')
  330. go
  331. insert sales
  332. values('8042', '483LL821', '09/14/87', 10, 'On invoice','SO1832')
  333. go
  334. insert sales
  335. values('8042', '483LL821', '09/14/87', 10, 'On invoice','HI1897')
  336. go
  337. insert sales
  338. values('8042', '483LL821', '09/14/87', 10, 'On invoice','DR1818')
  339. go
  340. insert sales
  341. values('7067', 'R4482', '10/17/87', 10, 'Net 60','PH1024')
  342. go
  343. insert sales
  344. values('7067', 'R4482', '10/17/87', 10, 'Net 60','MY1012')
  345. go
  346. insert sales
  347. values('7067', 'R4482', '10/17/87', 50, 'Net 60','PO1813')
  348. go
  349. insert sales
  350. values('7067', 'R4482', '10/17/87', 20, 'Net 60','PH9823')
  351. go
  352. insert sales
  353. values('7067', 'R4482', '10/17/87', 20, 'Net 60','MY1011')
  354. go
  355. insert titleauthor
  356. values('409-56-7008', 'BU1032', 1, 60)
  357. go
  358. insert titleauthor
  359. values('213-46-8915', 'BU1032', 2, 40)
  360. go
  361. insert titleauthor
  362. values('238-95-7766', 'PC1035', 1, 100)
  363. go
  364. insert titleauthor
  365. values('213-46-8915', 'BU2075', 1, 100)
  366. go
  367. insert titleauthor
  368. values('998-72-3567', 'PS2091', 1, 50)
  369. go
  370. insert titleauthor
  371. values('899-46-2035', 'PS2091', 2, 50)
  372. go
  373. insert titleauthor
  374. values('998-72-3567', 'PS2106', 1, 100)
  375. go
  376. insert titleauthor
  377. values('899-46-2035', 'MC3021', 2, 25)
  378. go
  379. insert titleauthor
  380. values('020-83-5948', 'MY1011', 1, 100)
  381. go
  382. insert titleauthor
  383. values('011-112-1211', 'MY1012', 1, 100)
  384. go
  385. insert titleauthor
  386. values('018-913-9422', 'PH1024', 1, 100)
  387. go
  388. insert titleauthor
  389. values('080-92-2323', 'DR1818', 1, 100)
  390. go
  391. insert titleauthor
  392. values('011-35-8631', 'PO1813', 1, 100)
  393. go
  394. insert titleauthor
  395. values('136-85-3857', 'DR0223', 1, 100)
  396. go
  397. insert titleauthor
  398. values('852-22-3431', 'PH9823', 1, 100)
  399. go
  400. insert titleauthor
  401. values('258-82-1314', 'HI1789', 1, 100)
  402. go
  403. insert titleauthor
  404. values('010-08-1946', 'PH8103', 1, 100)
  405. go
  406. insert titleauthor
  407. values('330-29-9328', 'HI1897', 1, 100)
  408. go
  409. insert titleauthor
  410. values('828-39-2382', 'SO1832', 1, 100)
  411. go
  412. insert titleauthor
  413. values('831-11-9825', 'MY8332', 1, 100)
  414. go
  415. insert titleauthor
  416. values('030-23-1432', 'HI1983', 1, 100)
  417. go
  418. insert titles
  419. values ('BU1032', "The Busy Executive's Database Guide",
  420. 'business', $19.99, $5000.00, 10, 4095,
  421. "An overview of available database systems with emphasis on common business applications.  Illustrated.",
  422. '06/12/85')
  423. go
  424. insert titles
  425. values ('PC1035', 'But Is It User Friendly?',
  426. 'popular_comp', $22.95, $7000.00, 16, 8780,
  427. "A survey of software for the naive user, focusing on the 'friendliness' of each.",
  428. '06/30/85')
  429. go
  430. insert titles
  431. values('BU2075', 'You Can Combat Computer Stress!',
  432. 'business', $2.99, $10125.00, 24, 18722,
  433. 'The latest medical and psychological techniques for living with the electronic office.  Easy-to-understand explanations.',
  434. '06/30/85')
  435. go
  436. insert titles
  437. values('PS2091', 'Is Anger the Enemy?',
  438. 'psychology', $10.95, $2275.00, 12, 2045,
  439. 'Carefully researched study of the effects of strong emotions on the body.  Metabolic charts included.',
  440. '06/15/85')
  441. go
  442. insert titles
  443. values('PS2106', 'Life Without Fear',
  444. 'psychology', $7.00, $6000.00, 10, 111,
  445. 'New exercise, meditation, and nutritional techniques that can reduce the shock of daily interactions. Popular audience.  Sample menus included, exercise video available separately.',
  446. '10/05/85')
  447. go
  448. insert titles
  449. values('MC3021', 'The Gourmet Microwave',
  450. 'mod_cook', $2.99, $15000.00, 24, 22246,
  451. 'Traditional French gourmet recipes adapted for modern microwave cooking.',
  452. '06/18/85')
  453. go
  454. insert titles
  455. values('MY1011', 'Berlin Alexanderplatz',
  456. 'mystery', $8.95, $10000.00, 24, 22246,
  457. 'Die Geschichte des Transportarbeiters Franz Biberkopf, der erste deutsche Gro_stadtroman von literarischen Rang.',
  458. '06/18/85')
  459. go
  460. insert titles
  461. values('MY1012', 'Der Auftrag',
  462. 'mystery', $8.95, $10000.00, 24, 22329,
  463. 'Eine Kriminalstory, aber eine von der metaphysischen Sorte, ein Gedankengebdude.',
  464. '05/23/71')
  465. go
  466. insert titles 
  467. values('PH1024', 'Vermintes Geldnde',
  468. 'philosophy', $12.95, $10000.00, 12, 12829, 
  469. 'Dieser j|ngste Band mit Schriften Heinrich Bvlls aus den Jahren 1977-1981 zeigt eine deutliche Verschiebung des Interesses von Literatur zur zeitkritischen Analyse und Stellungnahme.',
  470. '03/21/82') 
  471. go 
  472. insert titles  
  473. values('DR1818', 'Drau_en vor der Tur', 
  474. 'drama', $18.95, $15000.00, 14, 52829,  
  475. 'Das einzige Drama des fr|h verstorbenen Dichters ist ein verzweifelter Protestschrei gegen die zerstvrische und verderbnistrdchtige Macht des Krieges.',
  476. '12/18/85')  
  477. go
  478. insert titles   
  479. values('PO1813', 'Die Revolte',  
  480. 'politics', $8.95, $5000.00, 10, 52923,   
  481. 'Dutschke denkt, da_ sich heute derjenige als Revolutiondr begreifen m|_, der durch intellektuelle Arbeit und sinnvolle Erfahrung zu der Erkenntnis kommt:  Diese Gesellschaft kann und soll verdndert werden.',
  482. '2/8/82')   
  483. go 
  484. insert titles    
  485. values('DR0223', 'Une tempjte',  
  486. 'drama', $12.95, $7500.00, 12, 51823,    
  487. "Adaptie pour un thibtre nhgre, +La Tempjte; de Shakespeare donne un relief accru aux rapports de Prospiro et de Caliban; le mantre est blanc, l'esclave est noir.",
  488. '10/18/86')      
  489. go  
  490. insert titles     
  491. values('PH9823', "D'un chbteau l'autre",  
  492. 'philosophy', $22.95, $7500.00, 12, 81201,     
  493. 'Les chbteaux dont parle le titre sont en effet douloureux, agitis de spectres qui se nomment la guerre, la haine, la mishre.',
  494. '8/12/76')       
  495. go  
  496. insert titles
  497. values('HI1789', "L'or",
  498. 'history', $7.95, $7500.00, 10, 8201,
  499. 'La merveilleuse histoire du giniral Johann August Suter.',
  500. '5/10/70')
  501. go    
  502. insert titles 
  503. values('PH8103', 'La pensie sauvage', 
  504. 'philosophy', $27.95, $17500.00, 12, 18201, 
  505. "La pensie sauvage a trouvi la matihre et l'inspiration d'une logique dont les lois se bornent ` transposer les propriitis du riel, et qui, pour cette raison mjme, a pu permettre aux hommes d'avoir prise sur lui.",
  506. '10/20/86') 
  507. go     
  508. insert titles  
  509. values('HI1897', 'Manon Lescaut',  
  510. 'history', $12.95, $7500.00, 12, 1800,  
  511. 'Histoire du chevalier des Grieux.',
  512. '10/12/70')  
  513. go      
  514. insert titles   
  515. values('HI1983', "L'homme devant la mort",   
  516. 'history', $32.95, $15000.00, 12, 2800,   
  517. "Arihs a contribui magistralement au renouvellement de l'historiographie frangaise.",
  518. '3/22/87')   
  519. go       
  520. insert titles    
  521. values('SO1832', 'Les immimoriaux',    
  522. 'sociology', $22.95, $5000.00, 10, 8110,    
  523. 'Le seul ouvrage sur les nles du Pacifique.  Le ricit du drame que provoque le choc de deux civilisations.',
  524. '4/12/85')    
  525. go        
  526. insert titles     
  527. values('MY8332', 'Le moulin de la Sourdine',    
  528. 'mystery', $7.95, $5000.00, 12, 8800,     
  529. 'Une crime rivoltant vien de mettre en imoi la population de notre paisible citi.',
  530. '2/2/82')     
  531. go         
  532. insert stores
  533. values('7066',"Barnum's",'567 Pasadena Ave.','Tustin','CA', 'USA','92789')
  534. go
  535. insert stores
  536. values('7067','News & Brews','577 First St.','Los Gatos','CA','USA','96745')
  537. go
  538. insert stores
  539. values('7131','Doc-U-Mat: Quality Laundry and Books','24-A Avrogado Way','Remulade','WA','USA','98014')
  540. go
  541. insert stores
  542. values('8042','Bookbeat','679 Carson St.','Portland','OR','USA','89076')
  543. go
  544. insert stores
  545. values('6380',"Eric the Read Books",'788 Catamaugus Ave.','Seattle','WA','USA','98056')
  546. go
  547. insert stores
  548. values('7896','Fricative Bookshop','89 Madison St.','Fremont','CA','USA','90019')
  549. go
  550. insert discounts
  551. values('Initial Customer', NULL, NULL, NULL, 10.5)
  552. go
  553. insert discounts 
  554. values('Volume Discount', NULL, 100, 1000, 6.7)
  555. go
  556. insert discounts 
  557. values('Customer Discount', '8042', NULL, NULL, 5.0)
  558. go
  559. create trigger deltitle
  560. on titles
  561. for delete
  562. as
  563. if (select count(*) from deleted, sales
  564. where sales.title_id = deleted.title_id) >0
  565. begin
  566.     rollback transaction
  567.     print "You can't delete a title with sales."
  568. end
  569. go
  570. create view titleview
  571. as
  572. select title, au_ord, au_lname,
  573. price, ytd_sales
  574. from authors, titles, titleauthor
  575. where authors.au_id = titleauthor.au_id
  576. and titles.title_id = titleauthor.title_id
  577. go
  578. create procedure byroyalty @percentage int
  579. as
  580. select au_id from titleauthor
  581. where titleauthor.royaltyper = @percentage
  582. go
  583. grant execute on byroyalty to public
  584. go
  585. grant create procedure to public
  586. go
  587. if exists (select * from master.dbo.sysdatabases
  588.         where name = "interpubs")
  589. begin
  590.     execute sp_adduser guest
  591. end
  592. go
  593. if exists (select * from master.dbo.sysdatabases
  594.         where name = "interpubs")
  595. begin
  596.     grant all on titles to guest
  597.     grant all on authors to guest
  598.     grant all on titleauthor to guest
  599.     grant all on sales to guest
  600.     grant all on stores to guest
  601.     grant all on discounts to guest
  602.     grant exec on byroyalty to guest
  603.     grant create table to guest
  604.     grant create view to guest
  605.     grant create rule to guest
  606.     grant create default to guest
  607.     grant create procedure to guest
  608. end
  609. go
  610. use master
  611. go
  612. grant exec on sp_bindefault to guest
  613. grant exec on sp_unbindefault to guest
  614. grant exec on sp_bindrule to guest
  615. grant exec on sp_unbindrule to guest
  616. grant exec on sp_addtype to guest
  617. grant exec on sp_droptype to guest
  618. grant exec on sp_spaceused to guest
  619. grant exec on sp_help to guest
  620. grant exec on sp_helpgroup to guest
  621. grant exec on sp_helpindex to guest
  622. grant exec on sp_helprotect to guest
  623. go
  624.