Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1018 lines
35 KiB

  1. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_UserAccessLevels_AccessLevels]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
  2. ALTER TABLE [dbo].[UserAccessLevels] DROP CONSTRAINT FK_UserAccessLevels_AccessLevels
  3. GO
  4. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_UserAccessLevels_AuthorizedUsers]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
  5. ALTER TABLE [dbo].[UserAccessLevels] DROP CONSTRAINT FK_UserAccessLevels_AuthorizedUsers
  6. GO
  7. /****** Object: Table [dbo].[UserAccessLevels] Script Date: 8/12/2002 04:48:18 PM ******/
  8. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserAccessLevels]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  9. drop table [dbo].[UserAccessLevels]
  10. GO
  11. /****** Object: Table [dbo].[AccessLevels] Script Date: 8/12/2002 04:48:18 PM ******/
  12. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AccessLevels]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  13. drop table [dbo].[AccessLevels]
  14. GO
  15. /****** Object: Table [dbo].[ApprovalTypes] Script Date: 8/12/2002 04:48:18 PM ******/
  16. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ApprovalTypes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  17. drop table [dbo].[ApprovalTypes]
  18. GO
  19. /****** Object: Table [dbo].[Approvals] Script Date: 8/12/2002 04:48:18 PM ******/
  20. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Approvals]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  21. drop table [dbo].[Approvals]
  22. GO
  23. /****** Object: Table [dbo].[AuthorizedUsers] Script Date: 8/12/2002 04:48:18 PM ******/
  24. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AuthorizedUsers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  25. drop table [dbo].[AuthorizedUsers]
  26. GO
  27. /****** Object: Table [dbo].[CabAccess] Script Date: 8/12/2002 04:48:18 PM ******/
  28. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CabAccess]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  29. drop table [dbo].[CabAccess]
  30. GO
  31. /****** Object: Table [dbo].[CabAccessStatus] Script Date: 8/12/2002 04:48:18 PM ******/
  32. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CabAccessStatus]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  33. drop table [dbo].[CabAccessStatus]
  34. GO
  35. /****** Object: Table [dbo].[OcaAccessLevels] Script Date: 8/12/2002 04:48:18 PM ******/
  36. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaAccessLevels]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  37. drop table [dbo].[OcaAccessLevels]
  38. GO
  39. /****** Object: Table [dbo].[OcaApprovalTypes] Script Date: 8/12/2002 04:48:18 PM ******/
  40. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaApprovalTypes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  41. drop table [dbo].[OcaApprovalTypes]
  42. GO
  43. /****** Object: Table [dbo].[OcaApprovals] Script Date: 8/12/2002 04:48:18 PM ******/
  44. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaApprovals]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  45. drop table [dbo].[OcaApprovals]
  46. GO
  47. /****** Object: Table [dbo].[OcaAuthorizedUsers] Script Date: 8/12/2002 04:48:18 PM ******/
  48. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaAuthorizedUsers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  49. drop table [dbo].[OcaAuthorizedUsers]
  50. GO
  51. /****** Object: Table [dbo].[OcaUserAccessLevels] Script Date: 8/12/2002 04:48:18 PM ******/
  52. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaUserAccessLevels]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  53. drop table [dbo].[OcaUserAccessLevels]
  54. GO
  55. /****** Object: Table [dbo].[AccessLevels] Script Date: 8/12/2002 04:48:21 PM ******/
  56. CREATE TABLE [dbo].[AccessLevels] (
  57. [AccessLevelID] [int] NOT NULL ,
  58. [AccessDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  59. ) ON [PRIMARY]
  60. GO
  61. /****** Object: Table [dbo].[ApprovalTypes] Script Date: 8/12/2002 04:48:22 PM ******/
  62. CREATE TABLE [dbo].[ApprovalTypes] (
  63. [ApprovalTypeID] [int] NOT NULL ,
  64. [ApproverAccessLevelID] [int] NOT NULL ,
  65. [ApprovalDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
  66. ) ON [PRIMARY]
  67. GO
  68. /****** Object: Table [dbo].[Approvals] Script Date: 8/12/2002 04:48:22 PM ******/
  69. CREATE TABLE [dbo].[Approvals] (
  70. [UserID] [int] NOT NULL ,
  71. [ApprovalTypeID] [int] NOT NULL ,
  72. [ApproverUserID] [int] NULL ,
  73. [Reason] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  74. [DateApproved] [datetime] NULL ,
  75. [ApproverEmailStatus] [int] NULL ,
  76. [RequesterEmailStatus] [int] NULL
  77. ) ON [PRIMARY]
  78. GO
  79. /****** Object: Table [dbo].[AuthorizedUsers] Script Date: 8/12/2002 04:48:23 PM ******/
  80. CREATE TABLE [dbo].[AuthorizedUsers] (
  81. [UserID] [int] IDENTITY (1, 1) NOT NULL ,
  82. [UserAlias] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  83. [UserDomain] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  84. [DateSignedDCP] [datetime] NULL ,
  85. [WebSiteID] [int] NULL
  86. ) ON [PRIMARY]
  87. GO
  88. /****** Object: Table [dbo].[CabAccess] Script Date: 8/12/2002 04:48:23 PM ******/
  89. CREATE TABLE [dbo].[CabAccess] (
  90. [CabAccessID] [int] IDENTITY (1, 1) NOT NULL ,
  91. [iDatabase] [int] NOT NULL ,
  92. [iBucket] [int] NOT NULL ,
  93. [CabFilename] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  94. [CabPath] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  95. [UserID] [int] NOT NULL ,
  96. [StatusID] [int] NOT NULL ,
  97. [DestCabPathFile] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  98. [DateCopied] [datetime] NULL ,
  99. [DateRequested] [datetime] NULL
  100. ) ON [PRIMARY]
  101. GO
  102. /****** Object: Table [dbo].[CabAccessStatus] Script Date: 8/12/2002 04:48:23 PM ******/
  103. CREATE TABLE [dbo].[CabAccessStatus] (
  104. [StatusID] [int] NOT NULL ,
  105. [StatusDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
  106. ) ON [PRIMARY]
  107. GO
  108. /****** Object: Table [dbo].[OcaAccessLevels] Script Date: 8/12/2002 04:48:24 PM ******/
  109. CREATE TABLE [dbo].[OcaAccessLevels] (
  110. [AccessLevelID] [int] NOT NULL ,
  111. [AccessDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  112. ) ON [PRIMARY]
  113. GO
  114. /****** Object: Table [dbo].[OcaApprovalTypes] Script Date: 8/12/2002 04:48:24 PM ******/
  115. CREATE TABLE [dbo].[OcaApprovalTypes] (
  116. [ApprovalTypeID] [int] NOT NULL ,
  117. [ApproverAccessLevelID] [int] NOT NULL ,
  118. [ApprovalDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
  119. ) ON [PRIMARY]
  120. GO
  121. /****** Object: Table [dbo].[OcaApprovals] Script Date: 8/12/2002 04:48:24 PM ******/
  122. CREATE TABLE [dbo].[OcaApprovals] (
  123. [UserID] [int] NOT NULL ,
  124. [ApprovalTypeID] [int] NOT NULL ,
  125. [ApproverUserID] [int] NULL ,
  126. [Reason] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  127. [DateApproved] [datetime] NULL
  128. ) ON [PRIMARY]
  129. GO
  130. /****** Object: Table [dbo].[OcaAuthorizedUsers] Script Date: 8/12/2002 04:48:24 PM ******/
  131. CREATE TABLE [dbo].[OcaAuthorizedUsers] (
  132. [UserID] [int] IDENTITY (1, 1) NOT NULL ,
  133. [UserAlias] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  134. [UserDomain] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  135. [DateSignedDCP] [datetime] NULL
  136. ) ON [PRIMARY]
  137. GO
  138. /****** Object: Table [dbo].[OcaUserAccessLevels] Script Date: 8/12/2002 04:48:25 PM ******/
  139. CREATE TABLE [dbo].[OcaUserAccessLevels] (
  140. [UserAccessLevelID] [int] IDENTITY (1, 1) NOT NULL ,
  141. [UserID] [int] NOT NULL ,
  142. [AccessLevelID] [int] NOT NULL
  143. ) ON [PRIMARY]
  144. GO
  145. /****** Object: Table [dbo].[UserAccessLevels] Script Date: 8/12/2002 04:48:25 PM ******/
  146. CREATE TABLE [dbo].[UserAccessLevels] (
  147. [UserAccessLevelID] [int] IDENTITY (1, 1) NOT NULL ,
  148. [UserID] [int] NOT NULL ,
  149. [AccessLevelID] [int] NOT NULL
  150. ) ON [PRIMARY]
  151. GO
  152. ALTER TABLE [dbo].[CabAccess] WITH NOCHECK ADD
  153. CONSTRAINT [PK_CabAccess] PRIMARY KEY CLUSTERED
  154. (
  155. [CabAccessID]
  156. ) ON [PRIMARY]
  157. GO
  158. ALTER TABLE [dbo].[CabAccessStatus] WITH NOCHECK ADD
  159. CONSTRAINT [PK_CabAccessStatus] PRIMARY KEY CLUSTERED
  160. (
  161. [StatusID]
  162. ) ON [PRIMARY]
  163. GO
  164. ALTER TABLE [dbo].[OcaAccessLevels] WITH NOCHECK ADD
  165. CONSTRAINT [PK_OcaAccessLevels] PRIMARY KEY CLUSTERED
  166. (
  167. [AccessLevelID]
  168. ) ON [PRIMARY]
  169. GO
  170. ALTER TABLE [dbo].[OcaApprovalTypes] WITH NOCHECK ADD
  171. CONSTRAINT [PK_OcaApprovalTypes] PRIMARY KEY CLUSTERED
  172. (
  173. [ApprovalTypeID]
  174. ) ON [PRIMARY]
  175. GO
  176. ALTER TABLE [dbo].[OcaApprovals] WITH NOCHECK ADD
  177. CONSTRAINT [PK_OcaApprovals] PRIMARY KEY CLUSTERED
  178. (
  179. [UserID],
  180. [ApprovalTypeID]
  181. ) ON [PRIMARY]
  182. GO
  183. ALTER TABLE [dbo].[OcaAuthorizedUsers] WITH NOCHECK ADD
  184. CONSTRAINT [PK_OcaAuthorizedUsers] PRIMARY KEY CLUSTERED
  185. (
  186. [UserID]
  187. ) ON [PRIMARY]
  188. GO
  189. ALTER TABLE [dbo].[OcaUserAccessLevels] WITH NOCHECK ADD
  190. CONSTRAINT [PK_OcaUserAccessLevels] PRIMARY KEY CLUSTERED
  191. (
  192. [UserAccessLevelID]
  193. ) ON [PRIMARY]
  194. GO
  195. ALTER TABLE [dbo].[UserAccessLevels] WITH NOCHECK ADD
  196. CONSTRAINT [PK_UserAccessLevels] PRIMARY KEY CLUSTERED
  197. (
  198. [UserAccessLevelID]
  199. ) ON [PRIMARY]
  200. GO
  201. ALTER TABLE [dbo].[AccessLevels] WITH NOCHECK ADD
  202. CONSTRAINT [PK_AccessLevels] PRIMARY KEY NONCLUSTERED
  203. (
  204. [AccessLevelID]
  205. ) ON [PRIMARY]
  206. GO
  207. ALTER TABLE [dbo].[ApprovalTypes] WITH NOCHECK ADD
  208. CONSTRAINT [PK_ApprovalTypes] PRIMARY KEY NONCLUSTERED
  209. (
  210. [ApprovalTypeID]
  211. ) ON [PRIMARY]
  212. GO
  213. ALTER TABLE [dbo].[Approvals] WITH NOCHECK ADD
  214. CONSTRAINT [PK_Approvals] PRIMARY KEY NONCLUSTERED
  215. (
  216. [UserID],
  217. [ApprovalTypeID]
  218. ) ON [PRIMARY]
  219. GO
  220. ALTER TABLE [dbo].[AuthorizedUsers] WITH NOCHECK ADD
  221. CONSTRAINT [PK_AuthorizedUsers] PRIMARY KEY NONCLUSTERED
  222. (
  223. [UserID]
  224. ) ON [PRIMARY]
  225. GO
  226. CREATE INDEX [UserID] ON [dbo].[Approvals]([UserID]) ON [PRIMARY]
  227. GO
  228. CREATE UNIQUE INDEX [UserAndDomain] ON [dbo].[AuthorizedUsers]([UserAlias], [UserDomain]) ON [PRIMARY]
  229. GO
  230. CREATE INDEX [UserID] ON [dbo].[UserAccessLevels]([UserID]) ON [PRIMARY]
  231. GO
  232. ALTER TABLE [dbo].[UserAccessLevels] ADD
  233. CONSTRAINT [FK_UserAccessLevels_AccessLevels] FOREIGN KEY
  234. (
  235. [AccessLevelID]
  236. ) REFERENCES [dbo].[AccessLevels] (
  237. [AccessLevelID]
  238. ),
  239. CONSTRAINT [FK_UserAccessLevels_AuthorizedUsers] FOREIGN KEY
  240. (
  241. [UserID]
  242. ) REFERENCES [dbo].[AuthorizedUsers] (
  243. [UserID]
  244. )
  245. GO
  246. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_UserAccessLevels_AccessLevels]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
  247. ALTER TABLE [dbo].[UserAccessLevels] DROP CONSTRAINT FK_UserAccessLevels_AccessLevels
  248. GO
  249. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_UserAccessLevels_AuthorizedUsers]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
  250. ALTER TABLE [dbo].[UserAccessLevels] DROP CONSTRAINT FK_UserAccessLevels_AuthorizedUsers
  251. GO
  252. /****** Object: View dbo.Authorization_All Script Date: 8/12/2002 04:52:19 PM ******/
  253. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Authorization_All]') and OBJECTPROPERTY(id, N'IsView') = 1)
  254. drop view [dbo].[Authorization_All]
  255. GO
  256. /****** Object: View dbo.UserList Script Date: 8/12/2002 04:52:19 PM ******/
  257. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserList]') and OBJECTPROPERTY(id, N'IsView') = 1)
  258. drop view [dbo].[UserList]
  259. GO
  260. /****** Object: View dbo.ApprovalEmailList Script Date: 8/12/2002 04:52:19 PM ******/
  261. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ApprovalEmailList]') and OBJECTPROPERTY(id, N'IsView') = 1)
  262. drop view [dbo].[ApprovalEmailList]
  263. GO
  264. /****** Object: View dbo.ApprovalJeff Script Date: 8/12/2002 04:52:19 PM ******/
  265. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ApprovalJeff]') and OBJECTPROPERTY(id, N'IsView') = 1)
  266. drop view [dbo].[ApprovalJeff]
  267. GO
  268. /****** Object: View dbo.ApprovalList Script Date: 8/12/2002 04:52:19 PM ******/
  269. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ApprovalList]') and OBJECTPROPERTY(id, N'IsView') = 1)
  270. drop view [dbo].[ApprovalList]
  271. GO
  272. /****** Object: View dbo.CabsEmailList Script Date: 8/12/2002 04:52:19 PM ******/
  273. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CabsEmailList]') and OBJECTPROPERTY(id, N'IsView') = 1)
  274. drop view [dbo].[CabsEmailList]
  275. GO
  276. /****** Object: View dbo.CabsToBeCopied Script Date: 8/12/2002 04:52:19 PM ******/
  277. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CabsToBeCopied]') and OBJECTPROPERTY(id, N'IsView') = 1)
  278. drop view [dbo].[CabsToBeCopied]
  279. GO
  280. /****** Object: View dbo.CabsToBeDeleted Script Date: 8/12/2002 04:52:19 PM ******/
  281. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CabsToBeDeleted]') and OBJECTPROPERTY(id, N'IsView') = 1)
  282. drop view [dbo].[CabsToBeDeleted]
  283. GO
  284. /****** Object: View dbo.CabsWaitingForApproval Script Date: 8/12/2002 04:52:19 PM ******/
  285. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CabsWaitingForApproval]') and OBJECTPROPERTY(id, N'IsView') = 1)
  286. drop view [dbo].[CabsWaitingForApproval]
  287. GO
  288. /****** Object: View dbo.CopiedCabsList Script Date: 8/12/2002 04:52:19 PM ******/
  289. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CopiedCabsList]') and OBJECTPROPERTY(id, N'IsView') = 1)
  290. drop view [dbo].[CopiedCabsList]
  291. GO
  292. /****** Object: View dbo.OcaApprovalList Script Date: 8/12/2002 04:52:19 PM ******/
  293. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaApprovalList]') and OBJECTPROPERTY(id, N'IsView') = 1)
  294. drop view [dbo].[OcaApprovalList]
  295. GO
  296. /****** Object: View dbo.OcaUserList Script Date: 8/12/2002 04:52:19 PM ******/
  297. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaUserList]') and OBJECTPROPERTY(id, N'IsView') = 1)
  298. drop view [dbo].[OcaUserList]
  299. GO
  300. /****** Object: View dbo.RestrictedCabsList Script Date: 8/12/2002 04:52:19 PM ******/
  301. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RestrictedCabsList]') and OBJECTPROPERTY(id, N'IsView') = 1)
  302. drop view [dbo].[RestrictedCabsList]
  303. GO
  304. /****** Object: Table [dbo].[UserAccessLevels] Script Date: 8/12/2002 04:52:19 PM ******/
  305. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserAccessLevels]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  306. drop table [dbo].[UserAccessLevels]
  307. GO
  308. /****** Object: Table [dbo].[AccessLevels] Script Date: 8/12/2002 04:52:19 PM ******/
  309. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AccessLevels]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  310. drop table [dbo].[AccessLevels]
  311. GO
  312. /****** Object: Table [dbo].[Approvals] Script Date: 8/12/2002 04:52:19 PM ******/
  313. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Approvals]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  314. drop table [dbo].[Approvals]
  315. GO
  316. /****** Object: Table [dbo].[ApprovalTypes] Script Date: 8/12/2002 04:52:19 PM ******/
  317. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ApprovalTypes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  318. drop table [dbo].[ApprovalTypes]
  319. GO
  320. /****** Object: Table [dbo].[AuthorizedUsers] Script Date: 8/12/2002 04:52:19 PM ******/
  321. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AuthorizedUsers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  322. drop table [dbo].[AuthorizedUsers]
  323. GO
  324. /****** Object: Table [dbo].[CabAccess] Script Date: 8/12/2002 04:52:19 PM ******/
  325. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CabAccess]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  326. drop table [dbo].[CabAccess]
  327. GO
  328. /****** Object: Table [dbo].[CabAccessStatus] Script Date: 8/12/2002 04:52:19 PM ******/
  329. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CabAccessStatus]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  330. drop table [dbo].[CabAccessStatus]
  331. GO
  332. /****** Object: Table [dbo].[OcaAccessLevels] Script Date: 8/12/2002 04:52:19 PM ******/
  333. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaAccessLevels]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  334. drop table [dbo].[OcaAccessLevels]
  335. GO
  336. /****** Object: Table [dbo].[OcaApprovals] Script Date: 8/12/2002 04:52:19 PM ******/
  337. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaApprovals]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  338. drop table [dbo].[OcaApprovals]
  339. GO
  340. /****** Object: Table [dbo].[OcaApprovalTypes] Script Date: 8/12/2002 04:52:19 PM ******/
  341. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaApprovalTypes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  342. drop table [dbo].[OcaApprovalTypes]
  343. GO
  344. /****** Object: Table [dbo].[OcaAuthorizedUsers] Script Date: 8/12/2002 04:52:19 PM ******/
  345. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaAuthorizedUsers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  346. drop table [dbo].[OcaAuthorizedUsers]
  347. GO
  348. /****** Object: Table [dbo].[OcaUserAccessLevels] Script Date: 8/12/2002 04:52:19 PM ******/
  349. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OcaUserAccessLevels]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  350. drop table [dbo].[OcaUserAccessLevels]
  351. GO
  352. /****** Object: Table [dbo].[AccessLevels] Script Date: 8/12/2002 04:52:20 PM ******/
  353. CREATE TABLE [dbo].[AccessLevels] (
  354. [AccessLevelID] [int] NOT NULL ,
  355. [AccessDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  356. ) ON [PRIMARY]
  357. GO
  358. /****** Object: Table [dbo].[Approvals] Script Date: 8/12/2002 04:52:21 PM ******/
  359. CREATE TABLE [dbo].[Approvals] (
  360. [UserID] [int] NOT NULL ,
  361. [ApprovalTypeID] [int] NOT NULL ,
  362. [ApproverUserID] [int] NULL ,
  363. [Reason] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  364. [DateApproved] [datetime] NULL ,
  365. [ApproverEmailStatus] [int] NULL ,
  366. [RequesterEmailStatus] [int] NULL
  367. ) ON [PRIMARY]
  368. GO
  369. /****** Object: Table [dbo].[ApprovalTypes] Script Date: 8/12/2002 04:52:21 PM ******/
  370. CREATE TABLE [dbo].[ApprovalTypes] (
  371. [ApprovalTypeID] [int] NOT NULL ,
  372. [ApproverAccessLevelID] [int] NOT NULL ,
  373. [ApprovalDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
  374. ) ON [PRIMARY]
  375. GO
  376. /****** Object: Table [dbo].[AuthorizedUsers] Script Date: 8/12/2002 04:52:21 PM ******/
  377. CREATE TABLE [dbo].[AuthorizedUsers] (
  378. [UserID] [int] IDENTITY (1, 1) NOT NULL ,
  379. [UserAlias] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  380. [UserDomain] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  381. [DateSignedDCP] [datetime] NULL ,
  382. [WebSiteID] [int] NULL
  383. ) ON [PRIMARY]
  384. GO
  385. /****** Object: Table [dbo].[CabAccess] Script Date: 8/12/2002 04:52:22 PM ******/
  386. CREATE TABLE [dbo].[CabAccess] (
  387. [CabAccessID] [int] IDENTITY (1, 1) NOT NULL ,
  388. [iDatabase] [int] NOT NULL ,
  389. [iBucket] [int] NOT NULL ,
  390. [CabFilename] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  391. [CabPath] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  392. [UserID] [int] NOT NULL ,
  393. [StatusID] [int] NOT NULL ,
  394. [DestCabPathFile] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  395. [DateCopied] [datetime] NULL ,
  396. [DateRequested] [datetime] NULL
  397. ) ON [PRIMARY]
  398. GO
  399. /****** Object: Table [dbo].[CabAccessStatus] Script Date: 8/12/2002 04:52:22 PM ******/
  400. CREATE TABLE [dbo].[CabAccessStatus] (
  401. [StatusID] [int] NOT NULL ,
  402. [StatusDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
  403. ) ON [PRIMARY]
  404. GO
  405. /****** Object: Table [dbo].[OcaAccessLevels] Script Date: 8/12/2002 04:52:22 PM ******/
  406. CREATE TABLE [dbo].[OcaAccessLevels] (
  407. [AccessLevelID] [int] NOT NULL ,
  408. [AccessDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  409. ) ON [PRIMARY]
  410. GO
  411. /****** Object: Table [dbo].[OcaApprovals] Script Date: 8/12/2002 04:52:22 PM ******/
  412. CREATE TABLE [dbo].[OcaApprovals] (
  413. [UserID] [int] NOT NULL ,
  414. [ApprovalTypeID] [int] NOT NULL ,
  415. [ApproverUserID] [int] NULL ,
  416. [Reason] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  417. [DateApproved] [datetime] NULL
  418. ) ON [PRIMARY]
  419. GO
  420. /****** Object: Table [dbo].[OcaApprovalTypes] Script Date: 8/12/2002 04:52:23 PM ******/
  421. CREATE TABLE [dbo].[OcaApprovalTypes] (
  422. [ApprovalTypeID] [int] NOT NULL ,
  423. [ApproverAccessLevelID] [int] NOT NULL ,
  424. [ApprovalDescription] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
  425. ) ON [PRIMARY]
  426. GO
  427. /****** Object: Table [dbo].[OcaAuthorizedUsers] Script Date: 8/12/2002 04:52:23 PM ******/
  428. CREATE TABLE [dbo].[OcaAuthorizedUsers] (
  429. [UserID] [int] IDENTITY (1, 1) NOT NULL ,
  430. [UserAlias] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  431. [UserDomain] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  432. [DateSignedDCP] [datetime] NULL
  433. ) ON [PRIMARY]
  434. GO
  435. /****** Object: Table [dbo].[OcaUserAccessLevels] Script Date: 8/12/2002 04:52:23 PM ******/
  436. CREATE TABLE [dbo].[OcaUserAccessLevels] (
  437. [UserAccessLevelID] [int] IDENTITY (1, 1) NOT NULL ,
  438. [UserID] [int] NOT NULL ,
  439. [AccessLevelID] [int] NOT NULL
  440. ) ON [PRIMARY]
  441. GO
  442. /****** Object: Table [dbo].[UserAccessLevels] Script Date: 8/12/2002 04:52:23 PM ******/
  443. CREATE TABLE [dbo].[UserAccessLevels] (
  444. [UserAccessLevelID] [int] IDENTITY (1, 1) NOT NULL ,
  445. [UserID] [int] NOT NULL ,
  446. [AccessLevelID] [int] NOT NULL
  447. ) ON [PRIMARY]
  448. GO
  449. ALTER TABLE [dbo].[CabAccess] WITH NOCHECK ADD
  450. CONSTRAINT [PK_CabAccess] PRIMARY KEY CLUSTERED
  451. (
  452. [CabAccessID]
  453. ) ON [PRIMARY]
  454. GO
  455. ALTER TABLE [dbo].[CabAccessStatus] WITH NOCHECK ADD
  456. CONSTRAINT [PK_CabAccessStatus] PRIMARY KEY CLUSTERED
  457. (
  458. [StatusID]
  459. ) ON [PRIMARY]
  460. GO
  461. ALTER TABLE [dbo].[OcaAccessLevels] WITH NOCHECK ADD
  462. CONSTRAINT [PK_OcaAccessLevels] PRIMARY KEY CLUSTERED
  463. (
  464. [AccessLevelID]
  465. ) ON [PRIMARY]
  466. GO
  467. ALTER TABLE [dbo].[OcaApprovals] WITH NOCHECK ADD
  468. CONSTRAINT [PK_OcaApprovals] PRIMARY KEY CLUSTERED
  469. (
  470. [UserID],
  471. [ApprovalTypeID]
  472. ) ON [PRIMARY]
  473. GO
  474. ALTER TABLE [dbo].[OcaApprovalTypes] WITH NOCHECK ADD
  475. CONSTRAINT [PK_OcaApprovalTypes] PRIMARY KEY CLUSTERED
  476. (
  477. [ApprovalTypeID]
  478. ) ON [PRIMARY]
  479. GO
  480. ALTER TABLE [dbo].[OcaAuthorizedUsers] WITH NOCHECK ADD
  481. CONSTRAINT [PK_OcaAuthorizedUsers] PRIMARY KEY CLUSTERED
  482. (
  483. [UserID]
  484. ) ON [PRIMARY]
  485. GO
  486. ALTER TABLE [dbo].[OcaUserAccessLevels] WITH NOCHECK ADD
  487. CONSTRAINT [PK_OcaUserAccessLevels] PRIMARY KEY CLUSTERED
  488. (
  489. [UserAccessLevelID]
  490. ) ON [PRIMARY]
  491. GO
  492. ALTER TABLE [dbo].[UserAccessLevels] WITH NOCHECK ADD
  493. CONSTRAINT [PK_UserAccessLevels] PRIMARY KEY CLUSTERED
  494. (
  495. [UserAccessLevelID]
  496. ) ON [PRIMARY]
  497. GO
  498. ALTER TABLE [dbo].[AccessLevels] WITH NOCHECK ADD
  499. CONSTRAINT [PK_AccessLevels] PRIMARY KEY NONCLUSTERED
  500. (
  501. [AccessLevelID]
  502. ) ON [PRIMARY]
  503. GO
  504. ALTER TABLE [dbo].[Approvals] WITH NOCHECK ADD
  505. CONSTRAINT [PK_Approvals] PRIMARY KEY NONCLUSTERED
  506. (
  507. [UserID],
  508. [ApprovalTypeID]
  509. ) ON [PRIMARY]
  510. GO
  511. ALTER TABLE [dbo].[ApprovalTypes] WITH NOCHECK ADD
  512. CONSTRAINT [PK_ApprovalTypes] PRIMARY KEY NONCLUSTERED
  513. (
  514. [ApprovalTypeID]
  515. ) ON [PRIMARY]
  516. GO
  517. ALTER TABLE [dbo].[AuthorizedUsers] WITH NOCHECK ADD
  518. CONSTRAINT [PK_AuthorizedUsers] PRIMARY KEY NONCLUSTERED
  519. (
  520. [UserID]
  521. ) ON [PRIMARY]
  522. GO
  523. CREATE INDEX [UserID] ON [dbo].[Approvals]([UserID]) ON [PRIMARY]
  524. GO
  525. CREATE UNIQUE INDEX [UserAndDomain] ON [dbo].[AuthorizedUsers]([UserAlias], [UserDomain]) ON [PRIMARY]
  526. GO
  527. CREATE INDEX [UserID] ON [dbo].[UserAccessLevels]([UserID]) ON [PRIMARY]
  528. GO
  529. ALTER TABLE [dbo].[UserAccessLevels] ADD
  530. CONSTRAINT [FK_UserAccessLevels_AccessLevels] FOREIGN KEY
  531. (
  532. [AccessLevelID]
  533. ) REFERENCES [dbo].[AccessLevels] (
  534. [AccessLevelID]
  535. ),
  536. CONSTRAINT [FK_UserAccessLevels_AuthorizedUsers] FOREIGN KEY
  537. (
  538. [UserID]
  539. ) REFERENCES [dbo].[AuthorizedUsers] (
  540. [UserID]
  541. )
  542. GO
  543. SET QUOTED_IDENTIFIER ON
  544. GO
  545. SET ANSI_NULLS ON
  546. GO
  547. /****** Object: View dbo.ApprovalEmailList Script Date: 8/12/2002 04:52:24 PM ******/
  548. CREATE VIEW dbo.ApprovalEmailList
  549. AS
  550. SELECT dbo.Approvals.Reason, dbo.AuthorizedUsers.UserAlias, dbo.AuthorizedUsers.UserDomain, dbo.Approvals.ApprovalTypeID,
  551. dbo.AuthorizedUsers.UserID, dbo.ApprovalTypes.ApproverAccessLevelID, dbo.Approvals.ApproverEmailStatus, dbo.Approvals.RequesterEmailStatus,
  552. AuthorizedUsers_1.UserAlias AS ApproverUserAlias
  553. FROM dbo.Approvals INNER JOIN
  554. dbo.AuthorizedUsers ON dbo.Approvals.UserID = dbo.AuthorizedUsers.UserID INNER JOIN
  555. dbo.ApprovalTypes ON dbo.Approvals.ApprovalTypeID = dbo.ApprovalTypes.ApprovalTypeID LEFT OUTER JOIN
  556. dbo.AuthorizedUsers AuthorizedUsers_1 ON dbo.Approvals.ApproverUserID = AuthorizedUsers_1.UserID
  557. WHERE (dbo.Approvals.ApproverEmailStatus = 0) AND (dbo.Approvals.ApprovalTypeID = 1) OR
  558. (dbo.Approvals.RequesterEmailStatus = 0) AND (dbo.Approvals.ApprovalTypeID = 1)
  559. GO
  560. SET QUOTED_IDENTIFIER OFF
  561. GO
  562. SET ANSI_NULLS ON
  563. GO
  564. SET QUOTED_IDENTIFIER ON
  565. GO
  566. SET ANSI_NULLS ON
  567. GO
  568. /****** Object: View dbo.ApprovalJeff Script Date: 8/12/2002 04:52:24 PM ******/
  569. CREATE VIEW dbo.ApprovalJeff
  570. AS
  571. SELECT TOP 100 PERCENT
  572. Approvals.UserId,
  573. UserAlias,
  574. UserDomain,
  575. Reason,
  576. Dateapproved
  577. FROM
  578. Approvals
  579. INNER JOIN
  580. AuthorizedUsers
  581. ON
  582. AuthorizedUsers.UserId = Approvals.UserId
  583. ORDER BY
  584. Approvals.UserId
  585. GO
  586. SET QUOTED_IDENTIFIER OFF
  587. GO
  588. SET ANSI_NULLS ON
  589. GO
  590. SET QUOTED_IDENTIFIER ON
  591. GO
  592. SET ANSI_NULLS ON
  593. GO
  594. /****** Object: View dbo.ApprovalList Script Date: 8/12/2002 04:52:24 PM ******/
  595. CREATE VIEW dbo.ApprovalList
  596. AS
  597. SELECT Approvals.UserID, Approvals.ApprovalTypeID,
  598. Approvals.Reason, Approvals.DateApproved,
  599. ApprovalTypes.ApprovalDescription,
  600. AuthorizedUsers.UserAlias AS ApproverAlias,
  601. AuthorizedUsers.UserDomain AS ApproverDomain,
  602. Approvals.ApproverUserID,
  603. ApprovalTypes.ApproverAccessLevelID AS ApproverAccessLevelID
  604. FROM Approvals INNER JOIN
  605. ApprovalTypes ON
  606. Approvals.ApprovalTypeID = ApprovalTypes.ApprovalTypeID LEFT
  607. OUTER JOIN
  608. AuthorizedUsers ON
  609. Approvals.ApproverUserID = AuthorizedUsers.UserID
  610. GO
  611. SET QUOTED_IDENTIFIER OFF
  612. GO
  613. SET ANSI_NULLS ON
  614. GO
  615. SET QUOTED_IDENTIFIER ON
  616. GO
  617. SET ANSI_NULLS ON
  618. GO
  619. /****** Object: View dbo.CabsEmailList Script Date: 8/12/2002 04:52:24 PM ******/
  620. CREATE VIEW dbo.CabsEmailList
  621. AS
  622. SELECT dbo.Approvals.Reason, dbo.AuthorizedUsers.UserAlias, dbo.AuthorizedUsers.UserDomain, dbo.Approvals.ApprovalTypeID,
  623. dbo.AuthorizedUsers.UserID, dbo.ApprovalTypes.ApproverAccessLevelID, dbo.Approvals.ApproverEmailStatus, dbo.Approvals.RequesterEmailStatus,
  624. AuthorizedUsers_1.UserAlias AS ApproverUserAlias
  625. FROM dbo.Approvals INNER JOIN
  626. dbo.AuthorizedUsers ON dbo.Approvals.UserID = dbo.AuthorizedUsers.UserID INNER JOIN
  627. dbo.ApprovalTypes ON dbo.Approvals.ApprovalTypeID = dbo.ApprovalTypes.ApprovalTypeID LEFT OUTER JOIN
  628. dbo.AuthorizedUsers AuthorizedUsers_1 ON dbo.Approvals.ApproverUserID = AuthorizedUsers_1.UserID
  629. WHERE (dbo.Approvals.ApproverEmailStatus = 0) AND (dbo.Approvals.ApprovalTypeID = 2)
  630. GO
  631. SET QUOTED_IDENTIFIER OFF
  632. GO
  633. SET ANSI_NULLS ON
  634. GO
  635. SET QUOTED_IDENTIFIER OFF
  636. GO
  637. SET ANSI_NULLS ON
  638. GO
  639. /****** Object: View dbo.CabsToBeCopied Script Date: 8/12/2002 04:52:24 PM ******/
  640. CREATE VIEW dbo.CabsToBeCopied
  641. AS
  642. SELECT CabAccess.CabAccessID, CabAccess.CabFilename, CabAccess.CabPath, CabAccess.UserID, AuthorizedUsers.UserAlias,
  643. AuthorizedUsers.UserDomain, CabAccess.iDatabase, CabAccess.iBucket
  644. FROM dbo.CabAccess CabAccess INNER JOIN
  645. dbo.AuthorizedUsers AuthorizedUsers ON CabAccess.UserID = AuthorizedUsers.UserID INNER JOIN
  646. dbo.Approvals ON CabAccess.UserID = dbo.Approvals.UserID
  647. WHERE (CabAccess.StatusID = 1) AND (dbo.Approvals.ApproverUserID IS NOT NULL) AND (dbo.Approvals.DateApproved IS NOT NULL) AND
  648. (dbo.Approvals.Reason IS NOT NULL) AND (dbo.Approvals.UserID IS NOT NULL) AND (dbo.Approvals.ApprovalTypeID = 2)
  649. GO
  650. SET QUOTED_IDENTIFIER OFF
  651. GO
  652. SET ANSI_NULLS ON
  653. GO
  654. SET QUOTED_IDENTIFIER ON
  655. GO
  656. SET ANSI_NULLS ON
  657. GO
  658. /****** Object: View dbo.CabsToBeDeleted Script Date: 8/12/2002 04:52:24 PM ******/
  659. CREATE VIEW dbo.CabsToBeDeleted
  660. AS
  661. SELECT CabAccess.CabAccessID, CabAccess.CabFilename, CabAccess.UserID, AuthorizedUsers.UserAlias
  662. FROM dbo.CabAccess CabAccess INNER JOIN
  663. dbo.AuthorizedUsers AuthorizedUsers ON CabAccess.UserID = AuthorizedUsers.UserID
  664. WHERE (CabAccess.StatusID = 2) AND (CURRENT_TIMESTAMP > DATEADD(day, 14, CabAccess.DateCopied))
  665. GO
  666. SET QUOTED_IDENTIFIER OFF
  667. GO
  668. SET ANSI_NULLS ON
  669. GO
  670. SET QUOTED_IDENTIFIER ON
  671. GO
  672. SET ANSI_NULLS ON
  673. GO
  674. /****** Object: View dbo.CabsWaitingForApproval Script Date: 8/12/2002 04:52:25 PM ******/
  675. CREATE VIEW dbo.CabsWaitingForApproval
  676. AS
  677. SELECT CabFilename, CabPath, UserID, iDatabase, iBucket
  678. FROM dbo.CabAccess
  679. WHERE (StatusID = 1)
  680. GO
  681. SET QUOTED_IDENTIFIER OFF
  682. GO
  683. SET ANSI_NULLS ON
  684. GO
  685. SET QUOTED_IDENTIFIER ON
  686. GO
  687. SET ANSI_NULLS ON
  688. GO
  689. /****** Object: View dbo.CopiedCabsList Script Date: 8/12/2002 04:52:25 PM ******/
  690. CREATE VIEW dbo.CopiedCabsList
  691. AS
  692. SELECT dbo.CabAccess.DestCabPathFile, dbo.CabAccess.DateCopied, dbo.AuthorizedUsers.UserAlias, dbo.AuthorizedUsers.UserDomain,
  693. dbo.CabAccess.CabFilename, dbo.CabAccess.iBucket, dbo.CabAccess.iDatabase, dbo.CabAccess.CabPath
  694. FROM dbo.CabAccess INNER JOIN
  695. dbo.AuthorizedUsers ON dbo.CabAccess.UserID = dbo.AuthorizedUsers.UserID AND dbo.CabAccess.StatusID = 2
  696. GO
  697. SET QUOTED_IDENTIFIER OFF
  698. GO
  699. SET ANSI_NULLS ON
  700. GO
  701. SET QUOTED_IDENTIFIER ON
  702. GO
  703. SET ANSI_NULLS ON
  704. GO
  705. /****** Object: View dbo.OcaApprovalList Script Date: 8/12/2002 04:52:25 PM ******/
  706. CREATE VIEW dbo.OcaApprovalList
  707. AS
  708. SELECT OcaApprovals.UserID, OcaApprovals.ApprovalTypeID,
  709. OcaApprovals.Reason, OcaApprovals.DateApproved,
  710. OcaApprovalTypes.ApprovalDescription,
  711. OcaAuthorizedUsers.UserAlias AS ApproverAlias,
  712. OcaAuthorizedUsers.UserDomain AS ApproverDomain,
  713. OcaApprovals.ApproverUserID,
  714. OcaApprovalTypes.ApproverAccessLevelID AS ApproverAccessLevelID
  715. FROM OcaApprovals INNER JOIN
  716. OcaApprovalTypes ON
  717. OcaApprovals.ApprovalTypeID = OcaApprovalTypes.ApprovalTypeID LEFT
  718. OUTER JOIN
  719. OcaAuthorizedUsers ON
  720. OcaApprovals.ApproverUserID = OcaAuthorizedUsers.UserID
  721. GO
  722. SET QUOTED_IDENTIFIER OFF
  723. GO
  724. SET ANSI_NULLS ON
  725. GO
  726. SET QUOTED_IDENTIFIER ON
  727. GO
  728. SET ANSI_NULLS ON
  729. GO
  730. /****** Object: View dbo.OcaUserList Script Date: 8/12/2002 04:52:25 PM ******/
  731. CREATE VIEW dbo.OcaUserList
  732. AS
  733. SELECT OcaAuthorizedUsers.UserID, OcaAuthorizedUsers.UserAlias,
  734. OcaAuthorizedUsers.UserDomain,
  735. OcaAuthorizedUsers.DateSignedDCP,
  736. OcaAccessLevels.AccessDescription,
  737. OcaAccessLevels.AccessLevelID,
  738. CASE WHEN COUNT(OcaApprovals.ApprovalTypeID)
  739. > 0 THEN 'Yes' ELSE 'No' END 'HasApprovals',
  740. case when count(Ocaapprovals.ApproverUserID)<>count(Ocaapprovals.approvaltypeid) then 'Yes' ELSE 'No' END 'NeedsApproval'
  741. FROM OcaAuthorizedUsers INNER JOIN
  742. OcaUserAccessLevels ON
  743. OcaAuthorizedUsers.UserID = OcaUserAccessLevels.UserID INNER JOIN
  744. OcaAccessLevels ON
  745. OcaUserAccessLevels.AccessLevelID = OcaAccessLevels.AccessLevelID
  746. LEFT OUTER JOIN
  747. OcaApprovals ON
  748. OcaAuthorizedUsers.UserID = OcaApprovals.UserID
  749. GROUP BY OcaAuthorizedUsers.UserID, OcaAuthorizedUsers.UserAlias,
  750. OcaAuthorizedUsers.UserDomain,
  751. OcaAuthorizedUsers.DateSignedDCP,
  752. OcaAccessLevels.AccessDescription,
  753. OcaAccessLevels.AccessLevelID
  754. GO
  755. SET QUOTED_IDENTIFIER OFF
  756. GO
  757. SET ANSI_NULLS ON
  758. GO
  759. SET QUOTED_IDENTIFIER ON
  760. GO
  761. SET ANSI_NULLS ON
  762. GO
  763. /****** Object: View dbo.RestrictedCabsList Script Date: 8/12/2002 04:52:25 PM ******/
  764. CREATE VIEW dbo.RestrictedCabsList
  765. AS
  766. SELECT TOP 100 PERCENT dbo.AuthorizedUsers.UserAlias, dbo.AuthorizedUsers.UserDomain, dbo.CabAccessStatus.StatusDescription,
  767. dbo.CabAccess.DateCopied, dbo.Approvals.ApproverEmailStatus, dbo.Approvals.RequesterEmailStatus, dbo.Approvals.DateApproved,
  768. dbo.Approvals.ApproverUserID, dbo.CabAccess.iBucket, dbo.CabAccess.iDatabase, dbo.CabAccess.DestCabPathFile,
  769. dbo.CabAccess.DateRequested
  770. FROM dbo.CabAccess INNER JOIN
  771. dbo.CabAccessStatus ON dbo.CabAccess.StatusID = dbo.CabAccessStatus.StatusID INNER JOIN
  772. dbo.AuthorizedUsers ON dbo.CabAccess.UserID = dbo.AuthorizedUsers.UserID LEFT OUTER JOIN
  773. dbo.Approvals ON dbo.CabAccess.UserID = dbo.Approvals.UserID
  774. WHERE (dbo.Approvals.ApprovalTypeID = 2)
  775. ORDER BY dbo.CabAccess.DateRequested DESC, dbo.CabAccess.DateCopied DESC
  776. GO
  777. SET QUOTED_IDENTIFIER OFF
  778. GO
  779. SET ANSI_NULLS ON
  780. GO
  781. SET QUOTED_IDENTIFIER OFF
  782. GO
  783. SET ANSI_NULLS ON
  784. GO
  785. /****** Object: View dbo.Authorization_All Script Date: 8/12/2002 04:52:25 PM ******/
  786. CREATE VIEW dbo.Authorization_All
  787. AS
  788. SELECT TOP 100 PERCENT dbo.AccessLevels.AccessDescription, dbo.AuthorizedUsers.UserAlias, dbo.AuthorizedUsers.UserDomain,
  789. dbo.AuthorizedUsers.DateSignedDCP
  790. FROM dbo.AccessLevels INNER JOIN
  791. dbo.UserAccessLevels ON dbo.AccessLevels.AccessLevelID = dbo.UserAccessLevels.AccessLevelID INNER JOIN
  792. dbo.AuthorizedUsers ON dbo.UserAccessLevels.UserID = dbo.AuthorizedUsers.UserID
  793. ORDER BY dbo.AuthorizedUsers.UserAlias
  794. GO
  795. SET QUOTED_IDENTIFIER OFF
  796. GO
  797. SET ANSI_NULLS ON
  798. GO
  799. SET QUOTED_IDENTIFIER OFF
  800. GO
  801. SET ANSI_NULLS ON
  802. GO
  803. /****** Object: View dbo.UserList Script Date: 8/12/2002 04:52:25 PM ******/
  804. CREATE VIEW dbo.UserList
  805. AS
  806. SELECT AuthorizedUsers.UserID, AuthorizedUsers.UserAlias,
  807. AuthorizedUsers.UserDomain,
  808. AuthorizedUsers.DateSignedDCP,
  809. AccessLevels.AccessDescription,
  810. AccessLevels.AccessLevelID,
  811. CASE WHEN COUNT(Approvals.ApprovalTypeID)
  812. > 0 THEN 'Yes' ELSE 'No' END 'HasApprovals',
  813. case when count(approvals.ApproverUserID)<>count(approvals.approvaltypeid) then 'Yes' ELSE 'No' END 'NeedsApproval'
  814. FROM AuthorizedUsers INNER JOIN
  815. UserAccessLevels ON
  816. AuthorizedUsers.UserID = UserAccessLevels.UserID INNER JOIN
  817. AccessLevels ON
  818. UserAccessLevels.AccessLevelID = AccessLevels.AccessLevelID
  819. LEFT OUTER JOIN
  820. Approvals ON
  821. AuthorizedUsers.UserID = Approvals.UserID
  822. GROUP BY AuthorizedUsers.UserID, AuthorizedUsers.UserAlias,
  823. AuthorizedUsers.UserDomain,
  824. AuthorizedUsers.DateSignedDCP,
  825. AccessLevels.AccessDescription,
  826. AccessLevels.AccessLevelID
  827. GO
  828. SET QUOTED_IDENTIFIER OFF
  829. GO
  830. SET ANSI_NULLS ON
  831. GO