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.

916 lines
19 KiB

  1. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_BuildKBString]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  2. drop procedure [dbo].[SEP_BuildKBString]
  3. GO
  4. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_BuildOEMSolutions]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  5. drop procedure [dbo].[SEP_BuildOEMSolutions]
  6. GO
  7. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetAllSolutionData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  8. drop procedure [dbo].[SEP_GetAllSolutionData]
  9. GO
  10. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetBucketBugID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11. drop procedure [dbo].[SEP_GetBucketBugID]
  12. GO
  13. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetBucketNameByBucketID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  14. drop procedure [dbo].[SEP_GetBucketNameByBucketID]
  15. GO
  16. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetContacts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  17. drop procedure [dbo].[SEP_GetContacts]
  18. GO
  19. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetDeliveryTypeBySolutionType]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  20. drop procedure [dbo].[SEP_GetDeliveryTypeBySolutionType]
  21. GO
  22. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetModuleData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23. drop procedure [dbo].[SEP_GetModuleData]
  24. GO
  25. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetModules]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  26. drop procedure [dbo].[SEP_GetModules]
  27. GO
  28. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetProductData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  29. drop procedure [dbo].[SEP_GetProductData]
  30. GO
  31. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetProducts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  32. drop procedure [dbo].[SEP_GetProducts]
  33. GO
  34. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  35. drop procedure [dbo].[SEP_GetSolutionData]
  36. GO
  37. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionDataByIDNumbers]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  38. drop procedure [dbo].[SEP_GetSolutionDataByIDNumbers]
  39. GO
  40. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionIDByBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  41. drop procedure [dbo].[SEP_GetSolutionIDByBucket]
  42. GO
  43. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionIDbyIBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  44. drop procedure [dbo].[SEP_GetSolutionIDbyIBucket]
  45. GO
  46. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionLanguages]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  47. drop procedure [dbo].[SEP_GetSolutionLanguages]
  48. GO
  49. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionRequestsBySolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  50. drop procedure [dbo].[SEP_GetSolutionRequestsBySolutionID]
  51. GO
  52. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionSolvedBuckets]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  53. drop procedure [dbo].[SEP_GetSolutionSolvedBuckets]
  54. GO
  55. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionTypes]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  56. drop procedure [dbo].[SEP_GetSolutionTypes]
  57. GO
  58. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolvedBucketsbySolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  59. drop procedure [dbo].[SEP_GetSolvedBucketsbySolutionID]
  60. GO
  61. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetTemplateData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  62. drop procedure [dbo].[SEP_GetTemplateData]
  63. GO
  64. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetTemplates]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  65. drop procedure [dbo].[SEP_GetTemplates]
  66. GO
  67. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetiBucketValueByBucketID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  68. drop procedure [dbo].[SEP_GetiBucketValueByBucketID]
  69. GO
  70. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_RemoveBucketFromSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  71. drop procedure [dbo].[SEP_RemoveBucketFromSolution]
  72. GO
  73. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetModuleData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  74. drop procedure [dbo].[SEP_SetModuleData]
  75. GO
  76. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetProductData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  77. drop procedure [dbo].[SEP_SetProductData]
  78. GO
  79. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetSolutionData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  80. drop procedure [dbo].[SEP_SetSolutionData]
  81. GO
  82. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetSolvedBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  83. drop procedure [dbo].[SEP_SetSolvedBucket]
  84. GO
  85. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetTemplateData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  86. drop procedure [dbo].[SEP_SetTemplateData]
  87. GO
  88. SET QUOTED_IDENTIFIER ON
  89. GO
  90. SET ANSI_NULLS ON
  91. GO
  92. CREATE PROCEDURE SEP_BuildKBString( @Desc nvarchar(1024), @FinalKB nvarchar(100) OUTPUT ) AS
  93. --DECLARE @Desc nvarchar(1024)
  94. --select top 100 percent * from SolutionEx
  95. DECLARE @Counter int
  96. --DECLARE @FinalKB nvarchar(100)
  97. SET @Counter = 1
  98. SET @FinalKB = ''
  99. WHILE @Counter != LEN( @Desc )
  100. BEGIN
  101. IF( SUBSTRING( @Desc, @Counter, 4) = '<KB>' )
  102. BEGIN
  103. SET @Counter = @Counter + 4
  104. SET @FinalKB = @FinalKB + ' ' + SUBSTRING( @Desc, @Counter, 6 ) + CHAR(13) + CHAR(10)
  105. SET @Counter = @Counter + 11
  106. END
  107. ELSE
  108. BEGIN
  109. print 'no kb'
  110. BREAK
  111. END
  112. END
  113. GO
  114. SET QUOTED_IDENTIFIER OFF
  115. GO
  116. SET ANSI_NULLS ON
  117. GO
  118. SET QUOTED_IDENTIFIER ON
  119. GO
  120. SET ANSI_NULLS ON
  121. GO
  122. CREATE Procedure SEP_BuildOEMSolutions as
  123. DECLARE @Desc nvarchar(1000)
  124. DECLARE @KBString nvarchar(1000)
  125. DECLARE @szTemplate nvarchar(4000)
  126. DECLARE @szModule nvarchar(100)
  127. DECLARE @szContact nvarchar(100)
  128. DECLARE @SolutionID INT
  129. DECLARE SolCursor CURSOR FOR
  130. select SolutionID from SolutionEx order by solutionID
  131. OPEN SolCursor
  132. FETCH NEXT FROM SolCursor INTO @SolutionID
  133. WHILE @@FETCH_STATUS = 0
  134. BEGIN
  135. IF NOT EXISTS ( SELECT MSSolutionID from MSSolution where MSSolutionID=@SolutionID )
  136. BEGIN
  137. SELECT @Desc = Description from SolutionEx where SolutionID = @SolutionID
  138. SELECT @szModule = ModuleName from Modules where ModuleID = (SELECT ModuleID from SolutionEX where SolutionID = @SolutionID )
  139. SELECT @szContact = CompanyName from Contacts where ContactID = (SELECT ContactID from SolutionEX where SolutionID = @SolutionID )
  140. SELECT @szTemplate = Description from templates where TemplateID = (SELECT TemplateID from SolutionEX where SolutionID = @SolutionID )
  141. SELECT @szTemplate = REPLACE ( @szTemplate, '<BR>', CHAR(13) )
  142. SELECT @szTemplate = REPLACE ( @szTemplate, '<CONTACT></CONTACT>', @szContact )
  143. SELECT @szTemplate = REPLACE ( @szTemplate, '<MODULE></MODULE>', @szModule )
  144. EXEC SEP_BuildKBString @Desc, @KBString OUTPUT
  145. SET @szTemplate = @szTemplate + CHAR(13) + 'KB Articles: ' + @KBString
  146. SELECT @szTemplate as newTEmplate, @SolutionID as SolutionID
  147. if ( @szTemplate is NULL )
  148. SET @szTemplate = 'Could not generate solution text, @szTemplate is null'
  149. INSERT INTO MSSolution (MSSolutionID, SolutionProvider, SolutionText, LastUpdated ) VALUES
  150. ( @SolutionID, 'Microsoft', @szTemplate, GETDATE() )
  151. END
  152. FETCH NEXT FROM SolCursor INTO @SolutionID
  153. END
  154. CLOSE SolCursor
  155. DEALLOCATE SolCursor
  156. GO
  157. SET QUOTED_IDENTIFIER OFF
  158. GO
  159. SET ANSI_NULLS ON
  160. GO
  161. SET QUOTED_IDENTIFIER ON
  162. GO
  163. SET ANSI_NULLS OFF
  164. GO
  165. CREATE PROCEDURE SEP_GetAllSolutionData (
  166. @solutionID int = 0
  167. ) AS
  168. IF ( @SolutionID = 0 )
  169. BEGIN
  170. select SolutionID, Lang, SolutionTypeName, ModuleName, TemplateName, ProductName, CompanyName, BugID from Solutionex as SX
  171. left join SolutionTypes on SolutionType = SolutionTypeID
  172. left join Templates as T on sx.TemplateID = T.TemplateID
  173. left join Products as P on sx.ProductID = P.ProductID
  174. left join Contacts as C on sx.ContactID = C.ContactID
  175. left join Modules as M on sx.ModuleID = M.ModuleID
  176. order by SolutionID
  177. END
  178. ELSE
  179. BEGIN
  180. select SolutionID, Lang, SolutionTypeName, ModuleName, TemplateName, ProductName, CompanyName, BugID from Solutionex as SX
  181. left join SolutionTypes on SolutionType = SolutionTypeID
  182. left join Templates as T on sx.TemplateID = T.TemplateID
  183. left join Products as P on sx.ProductID = P.ProductID
  184. left join Contacts as C on sx.ContactID = C.ContactID
  185. left join Modules as M on sx.ModuleID = M.ModuleID
  186. WHERE SolutionID = @SolutionID
  187. END
  188. GO
  189. SET QUOTED_IDENTIFIER OFF
  190. GO
  191. SET ANSI_NULLS ON
  192. GO
  193. SET QUOTED_IDENTIFIER ON
  194. GO
  195. SET ANSI_NULLS OFF
  196. GO
  197. CREATE PROCEDURE SEP_GetBucketBugID(
  198. @iBucket int
  199. ) AS
  200. SELECT BugID FROM CrashDB2.dbo.RaidBugs where iBucket = @iBucket
  201. GO
  202. SET QUOTED_IDENTIFIER OFF
  203. GO
  204. SET ANSI_NULLS ON
  205. GO
  206. SET QUOTED_IDENTIFIER ON
  207. GO
  208. SET ANSI_NULLS OFF
  209. GO
  210. CREATE PROCEDURE SEP_GetBucketNameByBucketID(
  211. @iBucket int
  212. ) AS
  213. select BucketID from CrashDB2.dbo.Buckettoint where iBucket=@iBucket
  214. GO
  215. SET QUOTED_IDENTIFIER OFF
  216. GO
  217. SET ANSI_NULLS ON
  218. GO
  219. SET QUOTED_IDENTIFIER ON
  220. GO
  221. SET ANSI_NULLS ON
  222. GO
  223. CREATE PROCEDURE SEP_GetContacts
  224. AS
  225. SELECT ContactID, CompanyName FROM Contacts ORDER BY CompanyName
  226. GO
  227. SET QUOTED_IDENTIFIER OFF
  228. GO
  229. SET ANSI_NULLS ON
  230. GO
  231. SET QUOTED_IDENTIFIER ON
  232. GO
  233. SET ANSI_NULLS OFF
  234. GO
  235. CREATE PROCEDURE SEP_GetDeliveryTypeBySolutionType (
  236. @SolutionTypeID int
  237. ) AS
  238. SELECT DeliveryTypeID, DeliveryType FROM DeliveryTypeMap as M
  239. inner join DeliveryTypes as D on D.DeliveryID = M.DeliveryTypeID
  240. WHERE SolutionTypeID = @SolutionTypeID
  241. GO
  242. SET QUOTED_IDENTIFIER OFF
  243. GO
  244. SET ANSI_NULLS ON
  245. GO
  246. SET QUOTED_IDENTIFIER ON
  247. GO
  248. SET ANSI_NULLS OFF
  249. GO
  250. CREATE PROCEDURE SEP_GetModuleData (
  251. @ModuleID int
  252. ) AS
  253. SELECT ModuleName FROM Modules WHERE ModuleID = @ModuleID
  254. GO
  255. SET QUOTED_IDENTIFIER OFF
  256. GO
  257. SET ANSI_NULLS ON
  258. GO
  259. SET QUOTED_IDENTIFIER ON
  260. GO
  261. SET ANSI_NULLS ON
  262. GO
  263. CREATE PROCEDURE SEP_GetModules
  264. AS
  265. SELECT ModuleID, ModuleName FROM Modules ORDER BY ModuleName
  266. GO
  267. SET QUOTED_IDENTIFIER OFF
  268. GO
  269. SET ANSI_NULLS ON
  270. GO
  271. SET QUOTED_IDENTIFIER ON
  272. GO
  273. SET ANSI_NULLS OFF
  274. GO
  275. CREATE PROCEDURE SEP_GetProductData (
  276. @ProductID int
  277. ) AS
  278. SELECT ProductName FROM Products WHERE ProductID = @ProductID order by productName
  279. GO
  280. SET QUOTED_IDENTIFIER OFF
  281. GO
  282. SET ANSI_NULLS ON
  283. GO
  284. SET QUOTED_IDENTIFIER ON
  285. GO
  286. SET ANSI_NULLS ON
  287. GO
  288. CREATE PROCEDURE SEP_GetProducts
  289. AS
  290. SELECT ProductID, ProductName FROM Products ORDER BY ProductName
  291. GO
  292. SET QUOTED_IDENTIFIER OFF
  293. GO
  294. SET ANSI_NULLS ON
  295. GO
  296. SET QUOTED_IDENTIFIER ON
  297. GO
  298. SET ANSI_NULLS OFF
  299. GO
  300. CREATE PROCEDURE SEP_GetSolutionData (
  301. @SolutionID int,
  302. @Lang nvarchar(4)
  303. ) AS
  304. SELECT SolutionType, DeliveryType, SP, TemplateID, ProductID, [Description], ContactID, ModuleID, bugID
  305. FROM SolutionEx WHERE SolutionID=@SolutionID AND Lang = @Lang
  306. GO
  307. SET QUOTED_IDENTIFIER OFF
  308. GO
  309. SET ANSI_NULLS ON
  310. GO
  311. SET QUOTED_IDENTIFIER OFF
  312. GO
  313. SET ANSI_NULLS OFF
  314. GO
  315. CREATE PROCEDURE SEP_GetSolutionDataByIDNumbers(
  316. @SolutionType int,
  317. @ProductID int,
  318. @ContactID int,
  319. @ModuleID int
  320. ) AS
  321. DECLARE @Type nvarchar(256)
  322. DECLARE @Product nvarchar(256)
  323. DECLARE @Contact nvarchar(256)
  324. DECLARE @Module nvarchar(256)
  325. SELECT @Type = SolutionTypeName from SolutionTypes where SolutionTypeID = @SolutionType
  326. SELECT @Product = ProductName from Products where ProductID = @ProductID
  327. SELECT @Contact = ContactName from Contacts where ContactID = @ContactID
  328. SELECT @Module = ModuleName from Modules WHERE ModuleID = @ModuleID
  329. SELECT @Type as [Solution Type],
  330. @Product as [Product Name],
  331. @Contact as [Contact Name],
  332. @Module as [Module Name]
  333. GO
  334. SET QUOTED_IDENTIFIER OFF
  335. GO
  336. SET ANSI_NULLS ON
  337. GO
  338. SET QUOTED_IDENTIFIER ON
  339. GO
  340. SET ANSI_NULLS OFF
  341. GO
  342. CREATE PROCEDURE SEP_GetSolutionIDByBucket (
  343. @BucketID varchar(100)
  344. ) AS
  345. SELECT SolutionID from SolvedBuckets where Bucket = @BucketID
  346. GO
  347. SET QUOTED_IDENTIFIER OFF
  348. GO
  349. SET ANSI_NULLS ON
  350. GO
  351. SET QUOTED_IDENTIFIER ON
  352. GO
  353. SET ANSI_NULLS OFF
  354. GO
  355. CREATE PROCEDURE SEP_GetSolutionIDbyIBucket(
  356. @iBucket int
  357. ) AS
  358. SELECT SolutionID from SolvedBuckets where Bucket = @iBucket
  359. GO
  360. SET QUOTED_IDENTIFIER OFF
  361. GO
  362. SET ANSI_NULLS ON
  363. GO
  364. SET QUOTED_IDENTIFIER OFF
  365. GO
  366. SET ANSI_NULLS OFF
  367. GO
  368. CREATE PROCEDURE SEP_GetSolutionLanguages (
  369. @SolutionID int
  370. ) AS
  371. SELECT Lang from SolutionEX where SolutionID = @SolutionID
  372. GO
  373. SET QUOTED_IDENTIFIER OFF
  374. GO
  375. SET ANSI_NULLS ON
  376. GO
  377. SET QUOTED_IDENTIFIER ON
  378. GO
  379. SET ANSI_NULLS OFF
  380. GO
  381. CREATE PROCEDURE SEP_GetSolutionRequestsBySolutionID(
  382. @SolutionID int
  383. ) AS
  384. GO
  385. SET QUOTED_IDENTIFIER OFF
  386. GO
  387. SET ANSI_NULLS ON
  388. GO
  389. SET QUOTED_IDENTIFIER ON
  390. GO
  391. SET ANSI_NULLS OFF
  392. GO
  393. CREATE PROCEDURE SEP_GetSolutionSolvedBuckets (
  394. @SolutionID int
  395. ) AS
  396. --SELECT
  397. -- BucketID, BucketType as Type
  398. --FROM
  399. -- SolvedBuckets
  400. --LEFT JOIN
  401. -- CrashDB.dbo.BucketToInt ON strBucket = BucketID
  402. --WHERE
  403. -- SolutionID =@SolutionID
  404. SELECT strBucket as BucketID , BucketType as type FROM SolvedBuckets where SolutionID = @SolutionID
  405. GO
  406. SET QUOTED_IDENTIFIER OFF
  407. GO
  408. SET ANSI_NULLS ON
  409. GO
  410. SET QUOTED_IDENTIFIER ON
  411. GO
  412. SET ANSI_NULLS OFF
  413. GO
  414. CREATE PROCEDURE SEP_GetSolutionTypes
  415. AS
  416. SELECT SolutionTypeID, SolutionTypeName FROM SolutionTypes ORDER BY SolutionTypeID
  417. GO
  418. SET QUOTED_IDENTIFIER OFF
  419. GO
  420. SET ANSI_NULLS ON
  421. GO
  422. SET QUOTED_IDENTIFIER OFF
  423. GO
  424. SET ANSI_NULLS OFF
  425. GO
  426. CREATE PROCEDURE SEP_GetSolvedBucketsbySolutionID(
  427. @SolutionID int
  428. ) AS
  429. select Bucket as [Bucket ID], strBucket as [BucketName], SolutionID, BucketType from SolvedBuckets where SolutionID = @SolutionID
  430. GO
  431. SET QUOTED_IDENTIFIER OFF
  432. GO
  433. SET ANSI_NULLS ON
  434. GO
  435. SET QUOTED_IDENTIFIER OFF
  436. GO
  437. SET ANSI_NULLS OFF
  438. GO
  439. CREATE PROCEDURE SEP_GetTemplateData (
  440. @TemplateID int
  441. ) AS
  442. SELECT TemplateName, [Description] FROM Templates WHERE TemplateID = @TemplateID
  443. GO
  444. SET QUOTED_IDENTIFIER OFF
  445. GO
  446. SET ANSI_NULLS ON
  447. GO
  448. SET QUOTED_IDENTIFIER OFF
  449. GO
  450. SET ANSI_NULLS ON
  451. GO
  452. CREATE PROCEDURE SEP_GetTemplates
  453. AS
  454. SELECT TemplateID, TemplateName FROM Templates ORDER BY TemplateName
  455. GO
  456. SET QUOTED_IDENTIFIER OFF
  457. GO
  458. SET ANSI_NULLS ON
  459. GO
  460. SET QUOTED_IDENTIFIER ON
  461. GO
  462. SET ANSI_NULLS OFF
  463. GO
  464. CREATE PROCEDURE SEP_GetiBucketValueByBucketID(
  465. @BucketID varchar(100)
  466. ) AS
  467. SELECT iBucket from CrashDB2.dbo.BucketToInt where BucketID = @BucketID
  468. GO
  469. SET QUOTED_IDENTIFIER OFF
  470. GO
  471. SET ANSI_NULLS ON
  472. GO
  473. SET QUOTED_IDENTIFIER ON
  474. GO
  475. SET ANSI_NULLS OFF
  476. GO
  477. CREATE PROCEDURE SEP_RemoveBucketFromSolution (
  478. @BucketID varchar(100)
  479. )
  480. AS
  481. delete from SolvedBuckets where strBucket = @BucketID
  482. update crashdb2.dbo.dbgportal_BucketData set SolutionID = NULL where BucketID=@BucketID
  483. GO
  484. SET QUOTED_IDENTIFIER OFF
  485. GO
  486. SET ANSI_NULLS ON
  487. GO
  488. SET QUOTED_IDENTIFIER ON
  489. GO
  490. SET ANSI_NULLS OFF
  491. GO
  492. CREATE PROCEDURE SEP_SetModuleData (
  493. @ModuleID int,
  494. @ModuleName nvarchar(128)
  495. ) AS
  496. IF EXISTS (SELECT * FROM Modules WHERE ModuleID = @ModuleID)
  497. UPDATE Modules SET
  498. ModuleName = @ModuleName
  499. WHERE
  500. ModuleID = @ModuleID
  501. ELSE
  502. INSERT INTO Modules
  503. (ModuleName)
  504. VALUES
  505. (@ModuleName)
  506. GO
  507. SET QUOTED_IDENTIFIER OFF
  508. GO
  509. SET ANSI_NULLS ON
  510. GO
  511. SET QUOTED_IDENTIFIER ON
  512. GO
  513. SET ANSI_NULLS OFF
  514. GO
  515. CREATE PROCEDURE SEP_SetProductData (
  516. @ProductID int,
  517. @ProductName nvarchar(128)
  518. ) AS
  519. IF EXISTS (SELECT * FROM Products WHERE ProductID = @ProductID)
  520. UPDATE Products SET
  521. ProductName = @ProductName
  522. WHERE
  523. ProductID = @ProductID
  524. ELSE
  525. INSERT INTO Products
  526. (ProductName)
  527. VALUES
  528. (@ProductName)
  529. GO
  530. SET QUOTED_IDENTIFIER OFF
  531. GO
  532. SET ANSI_NULLS ON
  533. GO
  534. SET QUOTED_IDENTIFIER ON
  535. GO
  536. SET ANSI_NULLS OFF
  537. GO
  538. CREATE PROCEDURE SEP_SetSolutionData(
  539. @SolutionID int,
  540. @Lang nvarchar(4),
  541. @SolutionType tinyint,
  542. @DeliveryType tinyint,
  543. @SP tinyint,
  544. @TemplateID int,
  545. @ProductID int,
  546. @Description nvarchar(1024),
  547. @ContactID int,
  548. @ModuleID int,
  549. @BugID int
  550. ) AS
  551. IF ( @SolutionID = 0 )
  552. SELECT @SolutionID = MAX(SolutionID) + 1 FROM SolutionEX
  553. IF EXISTS (SELECT * FROM SolutionEx WHERE SolutionID = @SolutionID AND Lang = @Lang)
  554. UPDATE SolutionEx SET
  555. SolutionType = @SolutionType,
  556. DeliveryType = @DeliveryType,
  557. SP = @SP,
  558. TemplateID = @TemplateID,
  559. ProductID = @ProductID,
  560. [Description] = @Description,
  561. ContactID = @ContactID,
  562. ModuleID = @ModuleID,
  563. BugID = @BugID
  564. WHERE
  565. SolutionID = @SolutionID AND
  566. Lang = @Lang
  567. ELSE
  568. INSERT INTO SolutionEx
  569. (SolutionID, Lang, SolutionType, DeliveryType, SP, TemplateID, ProductID, [Description], ContactID, ModuleID, BugID)
  570. VALUES
  571. (@SolutionID, @Lang, @SolutionType, @DeliveryType, @SP, @TemplateID, @ProductID, @Description, @ContactID, @ModuleID, @BugID)
  572. SELECT @SolutionID as SolutionID
  573. GO
  574. SET QUOTED_IDENTIFIER OFF
  575. GO
  576. SET ANSI_NULLS ON
  577. GO
  578. SET QUOTED_IDENTIFIER ON
  579. GO
  580. SET ANSI_NULLS OFF
  581. GO
  582. CREATE PROCEDURE SEP_SetSolvedBucket(
  583. @BucketID varchar(100),
  584. @SolutionID int,
  585. @BucketType tinyint,
  586. @iBucket int=0
  587. )
  588. AS
  589. IF ( @iBucket = 0 )
  590. SELECT @iBucket = iBucket from CrashDB2.dbo.BucketToInt where BucketID = @BucketID
  591. IF EXISTS( SELECT * FROM SolvedBuckets where strBucket = @BucketID )
  592. UPDATE
  593. SolvedBuckets
  594. SET
  595. strBucket = @BucketID, SolutionID = @SolutionID, BucketType = @BucketType, Bucket=@iBucket
  596. WHERE
  597. strBucket=@BucketID
  598. ELSE
  599. INSERT INTO
  600. SolvedBuckets ( strBucket, SolutionID, BucketType, Bucket)
  601. VALUES
  602. (@BucketID, @SolutionID, @BucketType, @iBucket )
  603. GO
  604. SET QUOTED_IDENTIFIER OFF
  605. GO
  606. SET ANSI_NULLS ON
  607. GO
  608. SET QUOTED_IDENTIFIER OFF
  609. GO
  610. SET ANSI_NULLS OFF
  611. GO
  612. CREATE PROCEDURE SEP_SetTemplateData (
  613. @TemplateID int,
  614. @TemplateName nvarchar(32),
  615. @Description ntext
  616. ) AS
  617. IF EXISTS (SELECT * FROM Templates WHERE TemplateID = @TemplateID)
  618. UPDATE Templates SET
  619. TemplateName = @TemplateName,
  620. Description = @Description
  621. WHERE
  622. TemplateID = @TemplateID
  623. ELSE
  624. INSERT INTO Templates
  625. (TemplateName, Description)
  626. VALUES
  627. (@TemplateName, @Description)
  628. GO
  629. SET QUOTED_IDENTIFIER OFF
  630. GO
  631. SET ANSI_NULLS ON
  632. GO