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.

957 lines
27 KiB

  1. /****** Object: Stored Procedure dbo.SEP_GetAllSolutionData Script Date: 8/15/2002 03:43:08 PM ******/
  2. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetAllSolutionData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  3. drop procedure [dbo].[SEP_GetAllSolutionData]
  4. GO
  5. /****** Object: Stored Procedure dbo.SEP_GetContact Script Date: 8/15/2002 03:43:08 PM ******/
  6. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetContact]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  7. drop procedure [dbo].[SEP_GetContact]
  8. GO
  9. /****** Object: Stored Procedure dbo.SEP_GetContacts Script Date: 8/15/2002 03:43:08 PM ******/
  10. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetContacts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11. drop procedure [dbo].[SEP_GetContacts]
  12. GO
  13. /****** Object: Stored Procedure dbo.SEP_GetDeliveryTypeBySolutionType Script Date: 8/15/2002 03:43:08 PM ******/
  14. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetDeliveryTypeBySolutionType]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  15. drop procedure [dbo].[SEP_GetDeliveryTypeBySolutionType]
  16. GO
  17. /****** Object: Stored Procedure dbo.SEP_GetModuleData Script Date: 8/15/2002 03:43:08 PM ******/
  18. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetModuleData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  19. drop procedure [dbo].[SEP_GetModuleData]
  20. GO
  21. /****** Object: Stored Procedure dbo.SEP_GetModules Script Date: 8/15/2002 03:43:08 PM ******/
  22. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetModules]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23. drop procedure [dbo].[SEP_GetModules]
  24. GO
  25. /****** Object: Stored Procedure dbo.SEP_GetProductData Script Date: 8/15/2002 03:43:08 PM ******/
  26. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetProductData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  27. drop procedure [dbo].[SEP_GetProductData]
  28. GO
  29. /****** Object: Stored Procedure dbo.SEP_GetProducts Script Date: 8/15/2002 03:43:08 PM ******/
  30. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetProducts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  31. drop procedure [dbo].[SEP_GetProducts]
  32. GO
  33. /****** Object: Stored Procedure dbo.SEP_GetSolutionBySolutionID Script Date: 8/15/2002 03:43:08 PM ******/
  34. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionBySolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  35. drop procedure [dbo].[SEP_GetSolutionBySolutionID]
  36. GO
  37. /****** Object: Stored Procedure dbo.SEP_GetSolutionData Script Date: 8/15/2002 03:43:08 PM ******/
  38. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  39. drop procedure [dbo].[SEP_GetSolutionData]
  40. GO
  41. /****** Object: Stored Procedure dbo.SEP_GetSolutionIDs Script Date: 8/15/2002 03:43:08 PM ******/
  42. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionIDs]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  43. drop procedure [dbo].[SEP_GetSolutionIDs]
  44. GO
  45. /****** Object: Stored Procedure dbo.SEP_GetSolutionTypes Script Date: 8/15/2002 03:43:08 PM ******/
  46. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionTypes]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  47. drop procedure [dbo].[SEP_GetSolutionTypes]
  48. GO
  49. /****** Object: Stored Procedure dbo.SEP_GetSolvedBucketsbySolutionID Script Date: 8/15/2002 03:43:08 PM ******/
  50. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolvedBucketsbySolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  51. drop procedure [dbo].[SEP_GetSolvedBucketsbySolutionID]
  52. GO
  53. /****** Object: Stored Procedure dbo.SEP_GetTemplateData Script Date: 8/15/2002 03:43:08 PM ******/
  54. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetTemplateData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  55. drop procedure [dbo].[SEP_GetTemplateData]
  56. GO
  57. /****** Object: Stored Procedure dbo.SEP_GetTemplates Script Date: 8/15/2002 03:43:08 PM ******/
  58. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetTemplates]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  59. drop procedure [dbo].[SEP_GetTemplates]
  60. GO
  61. /****** Object: Stored Procedure dbo.SEP_SetContact Script Date: 8/15/2002 03:43:08 PM ******/
  62. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetContact]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  63. drop procedure [dbo].[SEP_SetContact]
  64. GO
  65. /****** Object: Stored Procedure dbo.SEP_SetModuleData Script Date: 8/15/2002 03:43:08 PM ******/
  66. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetModuleData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  67. drop procedure [dbo].[SEP_SetModuleData]
  68. GO
  69. /****** Object: Stored Procedure dbo.SEP_SetProductData Script Date: 8/15/2002 03:43:08 PM ******/
  70. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetProductData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  71. drop procedure [dbo].[SEP_SetProductData]
  72. GO
  73. /****** Object: Stored Procedure dbo.SEP_SetSolutionData Script Date: 8/15/2002 03:43:08 PM ******/
  74. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetSolutionData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  75. drop procedure [dbo].[SEP_SetSolutionData]
  76. GO
  77. /****** Object: Stored Procedure dbo.SEP_SetTemplateData Script Date: 8/15/2002 03:43:08 PM ******/
  78. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetTemplateData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  79. drop procedure [dbo].[SEP_SetTemplateData]
  80. GO
  81. /****** Object: Stored Procedure dbo.DBGPortal_GetCommentActions Script Date: 8/15/2002 03:43:08 PM ******/
  82. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBGPortal_GetCommentActions]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  83. drop procedure [dbo].[DBGPortal_GetCommentActions]
  84. GO
  85. /****** Object: Stored Procedure dbo.SEP_GetiBucketValueByBucketID Script Date: 8/15/2002 03:43:08 PM ******/
  86. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetiBucketValueByBucketID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  87. drop procedure [dbo].[SEP_GetiBucketValueByBucketID]
  88. GO
  89. /****** Object: Table [dbo].[Contacts] Script Date: 8/15/2002 03:43:08 PM ******/
  90. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Contacts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  91. drop table [dbo].[Contacts]
  92. GO
  93. /****** Object: Table [dbo].[DeliveryTypeMap] Script Date: 8/15/2002 03:43:08 PM ******/
  94. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DeliveryTypeMap]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  95. drop table [dbo].[DeliveryTypeMap]
  96. GO
  97. /****** Object: Table [dbo].[DeliveryTypes] Script Date: 8/15/2002 03:43:08 PM ******/
  98. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DeliveryTypes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  99. drop table [dbo].[DeliveryTypes]
  100. GO
  101. /****** Object: Table [dbo].[Modules] Script Date: 8/15/2002 03:43:08 PM ******/
  102. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Modules]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  103. drop table [dbo].[Modules]
  104. GO
  105. /****** Object: Table [dbo].[Products] Script Date: 8/15/2002 03:43:08 PM ******/
  106. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Products]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  107. drop table [dbo].[Products]
  108. GO
  109. /****** Object: Table [dbo].[SolutionEx] Script Date: 8/15/2002 03:43:08 PM ******/
  110. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SolutionEx]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  111. drop table [dbo].[SolutionEx]
  112. GO
  113. /****** Object: Table [dbo].[SolutionTypes] Script Date: 8/15/2002 03:43:08 PM ******/
  114. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SolutionTypes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  115. drop table [dbo].[SolutionTypes]
  116. GO
  117. /****** Object: Table [dbo].[SolvedBuckets] Script Date: 8/15/2002 03:43:08 PM ******/
  118. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SolvedBuckets]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  119. drop table [dbo].[SolvedBuckets]
  120. GO
  121. /****** Object: Table [dbo].[Templates] Script Date: 8/15/2002 03:43:08 PM ******/
  122. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Templates]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  123. drop table [dbo].[Templates]
  124. GO
  125. /****** Object: Table [dbo].[Contacts] Script Date: 8/15/2002 03:43:10 PM ******/
  126. CREATE TABLE [dbo].[Contacts] (
  127. [ContactID] [int] IDENTITY (1, 1) NOT NULL ,
  128. [CompanyName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  129. [CompanyAddress1] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  130. [CompanyAddress2] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  131. [CompanyCity] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  132. [CompanyState] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  133. [CompanyZip] [nvarchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  134. [CompanyMainPhone] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  135. [CompanySupportPhone] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  136. [CompanyFax] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  137. [CompanyWebSite] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  138. [ContactName] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  139. [ContactOccupation] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  140. [ContactAddress1] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  141. [ContactAddress2] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  142. [ContactCity] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  143. [ContactState] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  144. [ContactZip] [nvarchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  145. [ContactPhone] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  146. [ContactEMail] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  147. ) ON [PRIMARY]
  148. GO
  149. /****** Object: Table [dbo].[DeliveryTypeMap] Script Date: 8/15/2002 03:43:11 PM ******/
  150. CREATE TABLE [dbo].[DeliveryTypeMap] (
  151. [MapID] [int] NOT NULL ,
  152. [SolutionTypeID] [int] NOT NULL ,
  153. [DeliveryTypeID] [int] NOT NULL
  154. ) ON [PRIMARY]
  155. GO
  156. /****** Object: Table [dbo].[DeliveryTypes] Script Date: 8/15/2002 03:43:11 PM ******/
  157. CREATE TABLE [dbo].[DeliveryTypes] (
  158. [DeliveryID] [int] NOT NULL ,
  159. [DeliveryType] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  160. ) ON [PRIMARY]
  161. GO
  162. /****** Object: Table [dbo].[Modules] Script Date: 8/15/2002 03:43:11 PM ******/
  163. CREATE TABLE [dbo].[Modules] (
  164. [ModuleID] [int] IDENTITY (1, 1) NOT NULL ,
  165. [ModuleName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  166. ) ON [PRIMARY]
  167. GO
  168. /****** Object: Table [dbo].[Products] Script Date: 8/15/2002 03:43:11 PM ******/
  169. CREATE TABLE [dbo].[Products] (
  170. [ProductID] [int] IDENTITY (1, 1) NOT NULL ,
  171. [ProductName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  172. ) ON [PRIMARY]
  173. GO
  174. /****** Object: Table [dbo].[SolutionEx] Script Date: 8/15/2002 03:43:11 PM ******/
  175. CREATE TABLE [dbo].[SolutionEx] (
  176. [SolutionType] [tinyint] NULL ,
  177. [DeliveryType] [tinyint] NULL ,
  178. [SP] [tinyint] NULL ,
  179. [CrashType] [tinyint] NULL ,
  180. [SolutionID] [int] NOT NULL ,
  181. [TemplateID] [int] NULL ,
  182. [ProductID] [int] NULL ,
  183. [ContactID] [int] NULL ,
  184. [ModuleID] [int] NULL ,
  185. [BugID] [nvarchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  186. [QueryData] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  187. [Description] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  188. ) ON [PRIMARY]
  189. GO
  190. /****** Object: Table [dbo].[SolutionTypes] Script Date: 8/15/2002 03:43:11 PM ******/
  191. CREATE TABLE [dbo].[SolutionTypes] (
  192. [SolutionTypeID] [int] NOT NULL ,
  193. [SolutionTypeName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  194. ) ON [PRIMARY]
  195. GO
  196. /****** Object: Table [dbo].[SolvedBuckets] Script Date: 8/15/2002 03:43:12 PM ******/
  197. CREATE TABLE [dbo].[SolvedBuckets] (
  198. [SolutionID] [int] NOT NULL ,
  199. [SolutionType] [tinyint] NOT NULL ,
  200. [BucketID] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
  201. ) ON [PRIMARY]
  202. GO
  203. /****** Object: Table [dbo].[Templates] Script Date: 8/15/2002 03:43:12 PM ******/
  204. CREATE TABLE [dbo].[Templates] (
  205. [TemplateIndex] [int] IDENTITY (1, 1) NOT NULL ,
  206. [TemplateID] [int] NOT NULL ,
  207. [Lang] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  208. [Description] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  209. [TemplateName] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  210. ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
  211. GO
  212. SET QUOTED_IDENTIFIER OFF
  213. GO
  214. SET ANSI_NULLS OFF
  215. GO
  216. /****** Object: Stored Procedure dbo.DBGPortal_GetCommentActions Script Date: 8/15/2002 03:43:12 PM ******/
  217. CREATE PROCEDURE DBGPortal_GetCommentActions AS
  218. SELECT * FROM crashdb3.dbo.CommentActions WHERE ActionID <= 5
  219. GO
  220. SET QUOTED_IDENTIFIER OFF
  221. GO
  222. SET ANSI_NULLS ON
  223. GO
  224. SET QUOTED_IDENTIFIER ON
  225. GO
  226. SET ANSI_NULLS OFF
  227. GO
  228. /****** Object: Stored Procedure dbo.SEP_GetiBucketValueByBucketID Script Date: 8/15/2002 03:43:12 PM ******/
  229. CREATE PROCEDURE dbo.SEP_GetiBucketValueByBucketID(
  230. @BucketID varchar(100)
  231. ) AS
  232. SELECT iBucket from CrashDB2.dbo.BucketToInt where BucketID = @BucketID
  233. GO
  234. SET QUOTED_IDENTIFIER OFF
  235. GO
  236. SET ANSI_NULLS ON
  237. GO
  238. SET QUOTED_IDENTIFIER ON
  239. GO
  240. SET ANSI_NULLS OFF
  241. GO
  242. /****** Object: Stored Procedure dbo.SEP_GetAllSolutionData Script Date: 8/15/2002 03:43:12 PM ******/
  243. CREATE PROCEDURE SEP_GetAllSolutionData (
  244. @solutionID int = 0,
  245. @CrashType tinyint = 0
  246. ) AS
  247. IF ( @SolutionID = 0 )
  248. BEGIN
  249. IF ( @CrashType = 1 )
  250. BEGIN
  251. select SolutionID, Lang, SolutionTypeName, ModuleName, TemplateName, ProductName, CompanyName, BugID from Solutionex as SX
  252. left join SolutionTypes on SolutionType = SolutionTypeID
  253. left join Templates as T on sx.TemplateID = T.TemplateID
  254. left join Products as P on sx.ProductID = P.ProductID
  255. left join Contacts as C on sx.ContactID = C.ContactID
  256. left join Modules as M on sx.ModuleID = M.ModuleID
  257. where SX.CrashType = 1
  258. END
  259. ELSE
  260. BEGIN
  261. select SolutionID, Lang, SolutionTypeName, ModuleName, TemplateName, ProductName, CompanyName, BugID from Solutionex as SX
  262. left join SolutionTypes on SolutionType = SolutionTypeID
  263. left join Templates as T on sx.TemplateID = T.TemplateID
  264. left join Products as P on sx.ProductID = P.ProductID
  265. left join Contacts as C on sx.ContactID = C.ContactID
  266. left join Modules as M on sx.ModuleID = M.ModuleID
  267. where SX.CrashType <> 1
  268. END
  269. END
  270. ELSE
  271. BEGIN
  272. select SolutionID, Lang, SolutionTypeName, ModuleName, TemplateName, ProductName, CompanyName, BugID from Solutionex as SX
  273. left join SolutionTypes on SolutionType = SolutionTypeID
  274. left join Templates as T on sx.TemplateID = T.TemplateID
  275. left join Products as P on sx.ProductID = P.ProductID
  276. left join Contacts as C on sx.ContactID = C.ContactID
  277. left join Modules as M on sx.ModuleID = M.ModuleID
  278. WHERE SolutionID = @SolutionID
  279. END
  280. GO
  281. SET QUOTED_IDENTIFIER OFF
  282. GO
  283. SET ANSI_NULLS ON
  284. GO
  285. SET QUOTED_IDENTIFIER OFF
  286. GO
  287. SET ANSI_NULLS OFF
  288. GO
  289. /****** Object: Stored Procedure dbo.SEP_GetContact Script Date: 8/15/2002 03:43:12 PM ******/
  290. CREATE PROCEDURE SEP_GetContact(
  291. @ContactID int
  292. )
  293. AS
  294. SELECT * FROM Contacts WHERE ContactID = @ContactID
  295. GO
  296. SET QUOTED_IDENTIFIER OFF
  297. GO
  298. SET ANSI_NULLS ON
  299. GO
  300. SET QUOTED_IDENTIFIER ON
  301. GO
  302. SET ANSI_NULLS ON
  303. GO
  304. /****** Object: Stored Procedure dbo.SEP_GetContacts Script Date: 8/15/2002 03:43:12 PM ******/
  305. CREATE PROCEDURE SEP_GetContacts
  306. AS
  307. SELECT ContactID, CompanyName FROM Contacts ORDER BY CompanyName
  308. GO
  309. SET QUOTED_IDENTIFIER OFF
  310. GO
  311. SET ANSI_NULLS ON
  312. GO
  313. SET QUOTED_IDENTIFIER ON
  314. GO
  315. SET ANSI_NULLS OFF
  316. GO
  317. /****** Object: Stored Procedure dbo.SEP_GetDeliveryTypeBySolutionType Script Date: 8/15/2002 03:43:12 PM ******/
  318. CREATE PROCEDURE SEP_GetDeliveryTypeBySolutionType (
  319. @SolutionTypeID int
  320. ) AS
  321. SELECT DeliveryTypeID, DeliveryType FROM DeliveryTypeMap as M
  322. inner join DeliveryTypes as D on D.DeliveryID = M.DeliveryTypeID
  323. WHERE SolutionTypeID = @SolutionTypeID
  324. GO
  325. SET QUOTED_IDENTIFIER OFF
  326. GO
  327. SET ANSI_NULLS ON
  328. GO
  329. SET QUOTED_IDENTIFIER ON
  330. GO
  331. SET ANSI_NULLS OFF
  332. GO
  333. /****** Object: Stored Procedure dbo.SEP_GetModuleData Script Date: 8/15/2002 03:43:12 PM ******/
  334. CREATE PROCEDURE SEP_GetModuleData (
  335. @ModuleID int
  336. ) AS
  337. SELECT ModuleName FROM Modules WHERE ModuleID = @ModuleID
  338. GO
  339. SET QUOTED_IDENTIFIER OFF
  340. GO
  341. SET ANSI_NULLS ON
  342. GO
  343. SET QUOTED_IDENTIFIER ON
  344. GO
  345. SET ANSI_NULLS ON
  346. GO
  347. /****** Object: Stored Procedure dbo.SEP_GetModules Script Date: 8/15/2002 03:43:12 PM ******/
  348. CREATE PROCEDURE SEP_GetModules
  349. AS
  350. SELECT ModuleID, ModuleName FROM Modules ORDER BY ModuleName
  351. GO
  352. SET QUOTED_IDENTIFIER OFF
  353. GO
  354. SET ANSI_NULLS ON
  355. GO
  356. SET QUOTED_IDENTIFIER ON
  357. GO
  358. SET ANSI_NULLS OFF
  359. GO
  360. /****** Object: Stored Procedure dbo.SEP_GetProductData Script Date: 8/15/2002 03:43:12 PM ******/
  361. CREATE PROCEDURE SEP_GetProductData (
  362. @ProductID int
  363. ) AS
  364. SELECT ProductName FROM Products WHERE ProductID = @ProductID order by productName
  365. GO
  366. SET QUOTED_IDENTIFIER OFF
  367. GO
  368. SET ANSI_NULLS ON
  369. GO
  370. SET QUOTED_IDENTIFIER ON
  371. GO
  372. SET ANSI_NULLS ON
  373. GO
  374. /****** Object: Stored Procedure dbo.SEP_GetProducts Script Date: 8/15/2002 03:43:12 PM ******/
  375. CREATE PROCEDURE SEP_GetProducts
  376. AS
  377. SELECT ProductID, ProductName FROM Products ORDER BY ProductName
  378. GO
  379. SET QUOTED_IDENTIFIER OFF
  380. GO
  381. SET ANSI_NULLS ON
  382. GO
  383. SET QUOTED_IDENTIFIER OFF
  384. GO
  385. SET ANSI_NULLS OFF
  386. GO
  387. /****** Object: Stored Procedure dbo.SEP_GetSolutionBySolutionID Script Date: 8/15/2002 03:43:12 PM ******/
  388. CREATE PROCEDURE SEP_GetSolutionBySolutionID(
  389. @SolutionID int
  390. ) AS
  391. SELECT * from SolutionEx where SolutionID = @SolutionID
  392. GO
  393. SET QUOTED_IDENTIFIER OFF
  394. GO
  395. SET ANSI_NULLS ON
  396. GO
  397. SET QUOTED_IDENTIFIER ON
  398. GO
  399. SET ANSI_NULLS OFF
  400. GO
  401. /****** Object: Stored Procedure dbo.SEP_GetSolutionData Script Date: 8/15/2002 03:43:12 PM ******/
  402. CREATE PROCEDURE SEP_GetSolutionData(
  403. @TemplateID int,
  404. @ContactID int,
  405. @ProductID int,
  406. @ModuleID int,
  407. @Language nvarchar(4) = 'en'
  408. ) AS
  409. IF ( @Language <> 'en' )
  410. BEGIN
  411. IF NOT EXISTS (
  412. SELECT * FROM Templates where TemplateID = @TemplateID and Lang = @Language
  413. )
  414. SET @Language = 'en'
  415. END
  416. select
  417. (select ProductName from Products where ProductID=@ProductID) as ProductName ,
  418. (Select ModuleName from Modules where ModuleID = @ModuleID) as ModuleName,
  419. (Select CompanyName from Contacts where ContactID = @ContactID) as CompanyName,
  420. (Select CompanyMainPhone from Contacts where ContactID = @ContactID) as CompanyMainPhone,
  421. (Select CompanyWebSite from Contacts where ContactID = @ContactID) as CompanyWebsite,
  422. [Description]
  423. from Templates
  424. where TemplateID = @TemplateID and Lang=@Language
  425. GO
  426. SET QUOTED_IDENTIFIER OFF
  427. GO
  428. SET ANSI_NULLS ON
  429. GO
  430. SET QUOTED_IDENTIFIER OFF
  431. GO
  432. SET ANSI_NULLS OFF
  433. GO
  434. /****** Object: Stored Procedure dbo.SEP_GetSolutionIDs Script Date: 8/15/2002 03:43:12 PM ******/
  435. CREATE PROCEDURE SEP_GetSolutionIDs
  436. AS
  437. SELECT SolutionID, SolutionID FROM SolutionEx ORDER BY SolutionID
  438. GO
  439. SET QUOTED_IDENTIFIER OFF
  440. GO
  441. SET ANSI_NULLS ON
  442. GO
  443. SET QUOTED_IDENTIFIER OFF
  444. GO
  445. SET ANSI_NULLS OFF
  446. GO
  447. /****** Object: Stored Procedure dbo.SEP_GetSolutionTypes Script Date: 8/15/2002 03:43:13 PM ******/
  448. CREATE PROCEDURE SEP_GetSolutionTypes
  449. AS
  450. SELECT SolutionTypeID, SolutionTypeName FROM SolutionTypes ORDER BY SolutionTypeID
  451. GO
  452. SET QUOTED_IDENTIFIER OFF
  453. GO
  454. SET ANSI_NULLS ON
  455. GO
  456. SET QUOTED_IDENTIFIER OFF
  457. GO
  458. SET ANSI_NULLS OFF
  459. GO
  460. /****** Object: Stored Procedure dbo.SEP_GetSolvedBucketsbySolutionID Script Date: 8/15/2002 03:43:13 PM ******/
  461. CREATE PROCEDURE dbo.SEP_GetSolvedBucketsbySolutionID(
  462. @SolutionID int
  463. ) AS
  464. SELECT
  465. BucketID,
  466. SolutionID,
  467. SolutionType
  468. FROM
  469. SolvedBuckets
  470. WHERE
  471. SolutionID = @SolutionID
  472. GO
  473. SET QUOTED_IDENTIFIER OFF
  474. GO
  475. SET ANSI_NULLS ON
  476. GO
  477. SET QUOTED_IDENTIFIER OFF
  478. GO
  479. SET ANSI_NULLS OFF
  480. GO
  481. /****** Object: Stored Procedure dbo.SEP_GetTemplateData Script Date: 8/15/2002 03:43:13 PM ******/
  482. CREATE PROCEDURE SEP_GetTemplateData (
  483. @TemplateID int
  484. ) AS
  485. SELECT Lang, TemplateName, [Description] FROM Templates WHERE TemplateID = @TemplateID
  486. GO
  487. SET QUOTED_IDENTIFIER OFF
  488. GO
  489. SET ANSI_NULLS ON
  490. GO
  491. SET QUOTED_IDENTIFIER OFF
  492. GO
  493. SET ANSI_NULLS OFF
  494. GO
  495. /****** Object: Stored Procedure dbo.SEP_GetTemplates Script Date: 8/15/2002 03:43:13 PM ******/
  496. CREATE PROCEDURE SEP_GetTemplates
  497. AS
  498. SELECT TemplateID, TemplateName FROM Templates where lang='en' ORDER BY TemplateName
  499. GO
  500. SET QUOTED_IDENTIFIER OFF
  501. GO
  502. SET ANSI_NULLS ON
  503. GO
  504. SET QUOTED_IDENTIFIER ON
  505. GO
  506. SET ANSI_NULLS OFF
  507. GO
  508. /****** Object: Stored Procedure dbo.SEP_SetContact Script Date: 8/15/2002 03:43:13 PM ******/
  509. CREATE PROCEDURE SEP_SetContact (
  510. @ContactID int,
  511. @CompanyName nvarchar(128),
  512. @CompanyAddress1 nvarchar(64),
  513. @CompanyAddress2 nvarchar(64),
  514. @CompanyCity nvarchar(16),
  515. @CompanyState nvarchar(4),
  516. @CompanyZip nvarchar(16),
  517. @CompanyMainPhone nvarchar(16),
  518. @CompanySupportPhone nvarchar(16),
  519. @CompanyFax nvarchar(16),
  520. @CompanyWebSite nvarchar(128),
  521. @ContactName nvarchar(32),
  522. @ContactOccupation nvarchar(32),
  523. @ContactAddress1 nvarchar(64),
  524. @ContactAddress2 nvarchar(64),
  525. @ContactCity nvarchar(16),
  526. @ContactState nvarchar(4),
  527. @ContactZip nvarchar(16),
  528. @ContactPhone nvarchar(16),
  529. @ContactEMail nvarchar(64)
  530. ) AS
  531. IF EXISTS(SELECT * FROM Contacts WHERE ContactID = @ContactID)
  532. BEGIN
  533. UPDATE Contacts SET
  534. CompanyName = @CompanyName,
  535. CompanyAddress1 = @CompanyAddress1,
  536. CompanyAddress2 = @CompanyAddress2,
  537. CompanyCity = @CompanyCity,
  538. CompanyState = @CompanyState,
  539. CompanyZip = @CompanyZip,
  540. CompanyMainPhone = @CompanyMainPhone,
  541. CompanySupportPhone = @CompanySupportPhone,
  542. CompanyFax = @CompanyFax,
  543. CompanyWebSite = @CompanyWebSite,
  544. ContactName = @ContactName,
  545. ContactOccupation = @ContactOccupation,
  546. ContactAddress1 = @contactAddress1,
  547. ContactAddress2 = @ContactAddress2,
  548. ContactCity = @ContactCity,
  549. ContactState = @ContactState,
  550. ContactZip = @ContactZip,
  551. ContactPhone = @ContactPhone,
  552. ContactEMail = @ContactEMail
  553. WHERE
  554. ContactID = @ContactID
  555. SELECT @ContactID as ContactID
  556. END
  557. ELSE
  558. BEGIN
  559. INSERT INTO Contacts
  560. (CompanyName, CompanyAddress1, CompanyAddress2, CompanyCity, CompanyState, CompanyZip,
  561. CompanyMainPhone, CompanySupportPhone, CompanyFax, CompanyWebSite,
  562. ContactName, ContactOccupation, ContactAddress1, ContactAddress2, ContactCity, ContactState, ContactZip,
  563. ContactPhone, ContactEMail)
  564. VALUES
  565. (@CompanyName, @CompanyAddress1, @CompanyAddress2, @CompanyCity, @CompanyState, @CompanyZip,
  566. @CompanyMainPhone, @CompanySupportPhone, @CompanyFax, @CompanyWebSite,
  567. @ContactName, @ContactOccupation, @ContactAddress1, @ContactAddress2, @ContactCity, @ContactState, @ContactZip,
  568. @ContactPhone, @ContactEMail)
  569. SELECT @@Identity as ContactID
  570. END
  571. GO
  572. SET QUOTED_IDENTIFIER OFF
  573. GO
  574. SET ANSI_NULLS ON
  575. GO
  576. SET QUOTED_IDENTIFIER ON
  577. GO
  578. SET ANSI_NULLS OFF
  579. GO
  580. /****** Object: Stored Procedure dbo.SEP_SetModuleData Script Date: 8/15/2002 03:43:13 PM ******/
  581. CREATE PROCEDURE SEP_SetModuleData (
  582. @ModuleID int,
  583. @ModuleName nvarchar(128)
  584. ) AS
  585. IF EXISTS (SELECT * FROM Modules WHERE ModuleID = @ModuleID)
  586. BEGIN
  587. UPDATE Modules SET
  588. ModuleName = @ModuleName
  589. WHERE
  590. ModuleID = @ModuleID
  591. SELECT @ModuleID as ModuleID
  592. END
  593. ELSE
  594. BEGIN
  595. INSERT INTO Modules
  596. (ModuleName)
  597. VALUES
  598. (@ModuleName)
  599. SELECT @@IDENTITY AS ModuleID
  600. END
  601. GO
  602. SET QUOTED_IDENTIFIER OFF
  603. GO
  604. SET ANSI_NULLS ON
  605. GO
  606. SET QUOTED_IDENTIFIER ON
  607. GO
  608. SET ANSI_NULLS OFF
  609. GO
  610. /****** Object: Stored Procedure dbo.SEP_SetProductData Script Date: 8/15/2002 03:43:13 PM ******/
  611. CREATE PROCEDURE SEP_SetProductData (
  612. @ProductID int,
  613. @ProductName nvarchar(128)
  614. ) AS
  615. IF EXISTS (SELECT * FROM Products WHERE ProductID = @ProductID)
  616. BEGIN
  617. UPDATE Products SET
  618. ProductName = @ProductName
  619. WHERE
  620. ProductID = @ProductID
  621. SELECT @ProductID as ProductID
  622. END
  623. ELSE
  624. BEGIN
  625. INSERT INTO Products
  626. (ProductName)
  627. VALUES
  628. (@ProductName)
  629. SELECT @@IDENTITY AS ProductID
  630. END
  631. GO
  632. SET QUOTED_IDENTIFIER OFF
  633. GO
  634. SET ANSI_NULLS ON
  635. GO
  636. SET QUOTED_IDENTIFIER OFF
  637. GO
  638. SET ANSI_NULLS OFF
  639. GO
  640. /****** Object: Stored Procedure dbo.SEP_SetSolutionData Script Date: 8/15/2002 03:43:13 PM ******/
  641. CREATE PROCEDURE SEP_SetSolutionData(
  642. @SolutionID int,
  643. @SolutionType tinyint,
  644. @DeliveryType tinyint,
  645. @SP tinyint = 0,
  646. @TemplateID int,
  647. @ProductID int,
  648. @Description nvarchar(1024),
  649. @ContactID int,
  650. @ModuleID int,
  651. @UserMode tinyint = 0
  652. ) AS
  653. IF ( @SolutionID = 0 )
  654. SELECT @SolutionID = MAX(SolutionID) + 1 FROM SolutionEX
  655. IF EXISTS (SELECT * FROM SolutionEx WHERE SolutionID = @SolutionID)
  656. UPDATE SolutionEx SET
  657. SolutionType = @SolutionType,
  658. DeliveryType = @DeliveryType,
  659. SP = @SP,
  660. TemplateID = @TemplateID,
  661. ProductID = @ProductID,
  662. [Description] = @Description,
  663. ContactID = @ContactID,
  664. ModuleID = @ModuleID
  665. WHERE
  666. SolutionID = @SolutionID
  667. ELSE
  668. INSERT INTO SolutionEx
  669. (SolutionID, SolutionType, DeliveryType, SP, TemplateID, ProductID, [Description], ContactID, ModuleID )
  670. VALUES
  671. (@SolutionID, @SolutionType, @DeliveryType, @SP, @TemplateID, @ProductID, @Description, @ContactID, @ModuleID )
  672. SELECT @SolutionID as SolutionID
  673. GO
  674. SET QUOTED_IDENTIFIER OFF
  675. GO
  676. SET ANSI_NULLS ON
  677. GO
  678. SET QUOTED_IDENTIFIER OFF
  679. GO
  680. SET ANSI_NULLS OFF
  681. GO
  682. /****** Object: Stored Procedure dbo.SEP_SetTemplateData Script Date: 8/15/2002 03:43:13 PM ******/
  683. CREATE PROCEDURE SEP_SetTemplateData (
  684. @TemplateID int,
  685. @TemplateName nvarchar(32),
  686. @Description ntext,
  687. @Lang varchar(5) = 'en'
  688. ) AS
  689. DECLARE @NewID int
  690. IF EXISTS (SELECT * FROM Templates WHERE TemplateID = @TemplateID )
  691. BEGIN
  692. IF EXISTS( SELECT * FROM Templates where TemplateID = @TemplateID and Lang = @Lang )
  693. UPDATE Templates SET
  694. TemplateName = @TemplateName,
  695. Description = @Description
  696. WHERE
  697. TemplateID = @TemplateID and Lang = @Lang
  698. ELSE
  699. INSERT INTO Templates
  700. (TemplateName, Description, Lang, TemplateID )
  701. VALUES
  702. (@TemplateName, @Description, @Lang, @TemplateID )
  703. END
  704. ELSE
  705. BEGIN
  706. SELECT @NewID = MAX(TemplateID)+1 from Templates
  707. INSERT INTO Templates
  708. (TemplateName, Description, Lang, TemplateID )
  709. VALUES
  710. (@TemplateName, @Description, @Lang, @NewID )
  711. SELECT @NewID as TemplateID
  712. END
  713. GO
  714. SET QUOTED_IDENTIFIER OFF
  715. GO
  716. SET ANSI_NULLS ON
  717. GO