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.

852 lines
17 KiB

  1. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ApproveSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  2. drop procedure [dbo].[ApproveSolution]
  3. GO
  4. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CrashSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  5. drop procedure [dbo].[CrashSolution]
  6. GO
  7. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetClassSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  8. drop procedure [dbo].[GetClassSolution]
  9. GO
  10. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetClasses]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11. drop procedure [dbo].[GetClasses]
  12. GO
  13. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetContact]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  14. drop procedure [dbo].[GetContact]
  15. GO
  16. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetModule]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  17. drop procedure [dbo].[GetModule]
  18. GO
  19. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetMoreInfo]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  20. drop procedure [dbo].[GetMoreInfo]
  21. GO
  22. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetPreApprovedSolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23. drop procedure [dbo].[GetPreApprovedSolutionID]
  24. GO
  25. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetPreApprovedSolutions]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  26. drop procedure [dbo].[GetPreApprovedSolutions]
  27. GO
  28. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetProduct]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  29. drop procedure [dbo].[GetProduct]
  30. GO
  31. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  32. drop procedure [dbo].[GetSolution]
  33. GO
  34. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetSolutionClasses]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  35. drop procedure [dbo].[GetSolutionClasses]
  36. GO
  37. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetSolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  38. drop procedure [dbo].[GetSolutionID]
  39. GO
  40. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetTempClassSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  41. drop procedure [dbo].[GetTempClassSolution]
  42. GO
  43. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetTemplate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  44. drop procedure [dbo].[GetTemplate]
  45. GO
  46. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RecreatSolvedBucketIndex]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  47. drop procedure [dbo].[RecreatSolvedBucketIndex]
  48. GO
  49. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RecreateStopCodeIndex]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  50. drop procedure [dbo].[RecreateStopCodeIndex]
  51. GO
  52. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetContact]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  53. drop procedure [dbo].[SetContact]
  54. GO
  55. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetIndexBucket]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  56. drop procedure [dbo].[SetIndexBucket]
  57. GO
  58. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetIndexStopCode]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  59. drop procedure [dbo].[SetIndexStopCode]
  60. GO
  61. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetModule]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  62. drop procedure [dbo].[SetModule]
  63. GO
  64. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetPreApprovedCrashSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  65. drop procedure [dbo].[SetPreApprovedCrashSolution]
  66. GO
  67. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetPreApprovedLIveSolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  68. drop procedure [dbo].[SetPreApprovedLIveSolutionID]
  69. GO
  70. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetProduct]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  71. drop procedure [dbo].[SetProduct]
  72. GO
  73. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetSolution]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  74. drop procedure [dbo].[SetSolution]
  75. GO
  76. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SetTemplate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  77. drop procedure [dbo].[SetTemplate]
  78. GO
  79. SET QUOTED_IDENTIFIER OFF
  80. GO
  81. SET ANSI_NULLS ON
  82. GO
  83. CREATE PROCEDURE ApproveSolution(
  84. @SolutionID int,
  85. @ApprovedBy nvarchar(30),
  86. @ApprovedDate datetime
  87. ) AS
  88. UPDATE PreApprovedSolutions SET
  89. Approved = 1,
  90. ApprovedBy = @ApprovedBy,
  91. WhenApproved = @ApprovedDate
  92. WHERE SolutionID = @SolutionID
  93. GO
  94. SET QUOTED_IDENTIFIER OFF
  95. GO
  96. SET ANSI_NULLS ON
  97. GO
  98. SET QUOTED_IDENTIFIER OFF
  99. GO
  100. SET ANSI_NULLS ON
  101. GO
  102. CREATE PROCEDURE CrashSolution (
  103. @SolutionID int,
  104. @ClassID int
  105. ) AS
  106. UPDATE KaKnownIssue.dbo.CrashClass SET
  107. SolutionID = @SolutionID
  108. WHERE
  109. ClassID = @ClassID
  110. GO
  111. SET QUOTED_IDENTIFIER OFF
  112. GO
  113. SET ANSI_NULLS ON
  114. GO
  115. SET QUOTED_IDENTIFIER OFF
  116. GO
  117. SET ANSI_NULLS ON
  118. GO
  119. CREATE PROCEDURE GetClassSolution (
  120. @ClassID int
  121. ) AS
  122. SELECT SolutionID FROM KaKnownIssue.dbo.CrashClass WHERE ClassID = @ClassID
  123. GO
  124. SET QUOTED_IDENTIFIER OFF
  125. GO
  126. SET ANSI_NULLS ON
  127. GO
  128. SET QUOTED_IDENTIFIER OFF
  129. GO
  130. SET ANSI_NULLS ON
  131. GO
  132. CREATE PROCEDURE GetClasses
  133. AS
  134. SELECT KaCrash.ClassID, KaCrash.ClassID FROM KaKnownIssue.dbo.CrashClass KaCrash ORDER BY KaCrash.ClassID
  135. GO
  136. SET QUOTED_IDENTIFIER OFF
  137. GO
  138. SET ANSI_NULLS ON
  139. GO
  140. SET QUOTED_IDENTIFIER OFF
  141. GO
  142. SET ANSI_NULLS OFF
  143. GO
  144. CREATE PROCEDURE GetContact (
  145. @ContactID int
  146. ) AS
  147. SELECT CompanyName, CompanyAddress1, CompanyAddress2, CompanyCity, CompanyState, CompanyZip,
  148. CompanyMainPhone, CompanySupportPhone, CompanyFax, CompanyWebSite,
  149. ContactName, ContactAddress1, ContactAddress2, ContactCity, ContactState, ContactZip,
  150. contactPhone, ContactEMail, ContactOccupation
  151. FROM Contacts
  152. WHERE ContactID = @ContactID
  153. GO
  154. SET QUOTED_IDENTIFIER OFF
  155. GO
  156. SET ANSI_NULLS ON
  157. GO
  158. SET QUOTED_IDENTIFIER OFF
  159. GO
  160. SET ANSI_NULLS OFF
  161. GO
  162. CREATE PROCEDURE GetModule (
  163. @ModuleID int
  164. ) AS
  165. SELECT ModuleName FROM Modules WHERE ModuleID = @ModuleID
  166. GO
  167. SET QUOTED_IDENTIFIER OFF
  168. GO
  169. SET ANSI_NULLS ON
  170. GO
  171. SET QUOTED_IDENTIFIER OFF
  172. GO
  173. SET ANSI_NULLS OFF
  174. GO
  175. CREATE PROCEDURE GetMoreInfo(
  176. @BucketID int,
  177. @Lang nvarchar(4)
  178. ) AS
  179. --DECLARE @BucketID char(8)
  180. --SELECT @BucketID = BucketID FROM SolvedBuckets WHERE = @ClassID
  181. SELECT KBs FROM HelpInfo WHERE iStopCode = @BucketID AND Lang = @Lang
  182. GO
  183. SET QUOTED_IDENTIFIER OFF
  184. GO
  185. SET ANSI_NULLS ON
  186. GO
  187. SET QUOTED_IDENTIFIER ON
  188. GO
  189. SET ANSI_NULLS ON
  190. GO
  191. CREATE PROCEDURE GetPreApprovedSolutionID AS
  192. DECLARE @SolutionID int
  193. DECLARE MyCursor CURSOR FOR
  194. SELECT TOP 1 SolutionID + 1 AS MySolutionID
  195. FROM PreApprovedSolutions
  196. ORDER BY SolutionID DESC
  197. OPEN MyCursor
  198. FETCH MyCursor INTO @SolutionID
  199. CLOSE MyCursor
  200. DEALLOCATE MyCursor
  201. INSERT INTO PreApprovedSolutions
  202. (SolutionID, Lang, Approved )
  203. VALUES
  204. (@SolutionID, 'USA', '-1')
  205. SELECT @SolutionID AS MySolutionID
  206. GO
  207. SET QUOTED_IDENTIFIER OFF
  208. GO
  209. SET ANSI_NULLS ON
  210. GO
  211. SET QUOTED_IDENTIFIER ON
  212. GO
  213. SET ANSI_NULLS ON
  214. GO
  215. CREATE PROCEDURE GetPreApprovedSolutions AS
  216. SELECT SolutionID, Lang, SolutionType, ModuleID, BugID, Approved, ApprovedBy, WhenApproved, CreatedBy from PreApprovedSolutions order by SolutionID
  217. GO
  218. SET QUOTED_IDENTIFIER OFF
  219. GO
  220. SET ANSI_NULLS ON
  221. GO
  222. SET QUOTED_IDENTIFIER OFF
  223. GO
  224. SET ANSI_NULLS ON
  225. GO
  226. CREATE PROCEDURE GetProduct (
  227. @ProductID int
  228. ) AS
  229. SELECT ProductName FROM Products WHERE ProductID = @ProductID
  230. GO
  231. SET QUOTED_IDENTIFIER OFF
  232. GO
  233. SET ANSI_NULLS ON
  234. GO
  235. SET QUOTED_IDENTIFIER OFF
  236. GO
  237. SET ANSI_NULLS OFF
  238. GO
  239. CREATE PROCEDURE GetSolution(
  240. @ClassID int,
  241. @Lang nvarchar(4)
  242. ) AS
  243. ----SELECT SolutionType, SP, TemplateID, ProductID, Description, ContactID, ModuleID
  244. -----FROM KaKnownIssue.dbo.SolutionEx KaSolution INNER JOIN KaKnownIssue.dbo.CrashClass KaCrash ON
  245. --KaSolution.SolutionID = KaCrash.SolutionID
  246. --WHERE ClassID = @ClassID AND Lang = @Lang AND KaSolution.SolutionID <> 1
  247. SELECT SolutionType, SP, TemplateID, ProductID, Description, ContactID, ModuleID, BucketType
  248. FROM SolutionEx KaSolution INNER JOIN SolvedBuckets KaCrash ON
  249. KaSolution.SolutionID = KaCrash.SolutionID
  250. WHERE Bucket = @ClassID AND Lang = @Lang AND KaSolution.SolutionID <> 1
  251. GO
  252. SET QUOTED_IDENTIFIER OFF
  253. GO
  254. SET ANSI_NULLS ON
  255. GO
  256. SET QUOTED_IDENTIFIER OFF
  257. GO
  258. SET ANSI_NULLS ON
  259. GO
  260. CREATE PROCEDURE GetSolutionClasses (
  261. @SolutionID int
  262. ) AS
  263. SELECT CrashClass.ClassID, HintKey, Data FROM KaKnownIssue.dbo.CrashClass CrashClass
  264. LEFT JOIN (SELECT TOP 1 ClassID, HintKey, Data FROM KaKnownIssue.dbo.HintData ORDER BY DataID) AS Hint
  265. ON CrashClass.ClassID = Hint.ClassID
  266. WHERE CrashClass.SolutionID = @SolutionID AND SolutionID <> 0
  267. GO
  268. SET QUOTED_IDENTIFIER OFF
  269. GO
  270. SET ANSI_NULLS ON
  271. GO
  272. SET QUOTED_IDENTIFIER OFF
  273. GO
  274. SET ANSI_NULLS ON
  275. GO
  276. CREATE PROCEDURE GetSolutionID
  277. AS
  278. DECLARE @SolutionID int
  279. DECLARE MyCursor CURSOR FOR
  280. SELECT TOP 1 KaCrash.SolutionID + 1 AS MySolutionID
  281. FROM KaKnownIssue.dbo.SolutionEx KaCrash
  282. ORDER BY KaCrash.SolutionID DESC
  283. OPEN MyCursor
  284. FETCH MyCursor INTO @SolutionID
  285. CLOSE MyCursor
  286. DEALLOCATE MyCursor
  287. INSERT INTO KaKnownIssue.dbo.SolutionEx
  288. (SolutionID, Lang)
  289. VALUES
  290. (@SolutionID, 'USA')
  291. SELECT @SolutionID AS MySolutionID
  292. GO
  293. SET QUOTED_IDENTIFIER OFF
  294. GO
  295. SET ANSI_NULLS ON
  296. GO
  297. SET QUOTED_IDENTIFIER OFF
  298. GO
  299. SET ANSI_NULLS ON
  300. GO
  301. CREATE PROCEDURE GetTempClassSolution (
  302. @ClassID int
  303. ) AS
  304. SELECT SolutionID, Approved
  305. FROM PreApprovedSolutions WHERE
  306. SolutionID = (SELECT SolutionID FROM PreApprovedSolutionClassIds WHERE ClassID = @ClassID)
  307. GO
  308. SET QUOTED_IDENTIFIER OFF
  309. GO
  310. SET ANSI_NULLS ON
  311. GO
  312. SET QUOTED_IDENTIFIER OFF
  313. GO
  314. SET ANSI_NULLS OFF
  315. GO
  316. CREATE PROCEDURE GetTemplate (
  317. @TemplateID int
  318. ) AS
  319. SELECT TemplateName, Description FROM Templates WHERE TemplateID = @TemplateID
  320. GO
  321. SET QUOTED_IDENTIFIER OFF
  322. GO
  323. SET ANSI_NULLS ON
  324. GO
  325. SET QUOTED_IDENTIFIER OFF
  326. GO
  327. SET ANSI_NULLS OFF
  328. GO
  329. CREATE PROCEDURE [dbo].[RecreatSolvedBucketIndex]
  330. AS
  331. DROP INDEX Incident.SOLVEDBUCKET_INDEX
  332. CREATE INDEX SOLVEDBUCKET_INDEX on SolvedBuckets (Bucket)
  333. GO
  334. SET QUOTED_IDENTIFIER OFF
  335. GO
  336. SET ANSI_NULLS ON
  337. GO
  338. SET QUOTED_IDENTIFIER OFF
  339. GO
  340. SET ANSI_NULLS OFF
  341. GO
  342. CREATE PROCEDURE [dbo].[RecreateStopCodeIndex]
  343. AS
  344. DROP INDEX Incident.STOPCODE_INDEX
  345. CREATE INDEX STOPCODE_INDEX on HelpInfo (iStopCode)
  346. GO
  347. SET QUOTED_IDENTIFIER OFF
  348. GO
  349. SET ANSI_NULLS ON
  350. GO
  351. SET QUOTED_IDENTIFIER OFF
  352. GO
  353. SET ANSI_NULLS ON
  354. GO
  355. CREATE PROCEDURE SetContact (
  356. @ContactID int,
  357. @CompanyName nvarchar(128),
  358. @CompanyAddress1 nvarchar(64),
  359. @CompanyAddress2 nvarchar(64),
  360. @CompanyCity nvarchar(16),
  361. @CompanyState nvarchar(4),
  362. @CompanyZip nvarchar(16),
  363. @CompanyMainPhone nvarchar(16),
  364. @CompanySupportPhone nvarchar(16),
  365. @CompanyFax nvarchar(16),
  366. @CompanyWebSite nvarchar(128),
  367. @ContactName nvarchar(32),
  368. @ContactOccupation nvarchar(32),
  369. @ContactAddress1 nvarchar(64),
  370. @ContactAddress2 nvarchar(64),
  371. @ContactCity nvarchar(16),
  372. @ContactState nvarchar(4),
  373. @ContactZip nvarchar(16),
  374. @ContactPhone nvarchar(16),
  375. @ContactEMail nvarchar(64)
  376. ) AS
  377. IF EXISTS(SELECT * FROM Contacts WHERE ContactID = @ContactID)
  378. UPDATE Contacts SET
  379. CompanyName = @CompanyName,
  380. CompanyAddress1 = @CompanyAddress1,
  381. CompanyAddress2 = @CompanyAddress2,
  382. CompanyCity = @CompanyCity,
  383. CompanyState = @CompanyState,
  384. CompanyZip = @CompanyZip,
  385. CompanyMainPhone = @CompanyMainPhone,
  386. CompanySupportPhone = @CompanySupportPhone,
  387. CompanyFax = @CompanyFax,
  388. CompanyWebSite = @CompanyWebSite,
  389. ContactName = @ContactName,
  390. ContactOccupation = @ContactOccupation,
  391. ContactAddress1 = @contactAddress1,
  392. ContactAddress2 = @ContactAddress2,
  393. ContactCity = @ContactCity,
  394. ContactState = @ContactState,
  395. ContactZip = @ContactZip,
  396. ContactPhone = @ContactPhone,
  397. ContactEMail = @ContactEMail
  398. WHERE
  399. ContactID = @ContactID
  400. ELSE
  401. INSERT INTO Contacts
  402. (CompanyName, CompanyAddress1, CompanyAddress2, CompanyCity, CompanyState, CompanyZip,
  403. CompanyMainPhone, CompanySupportPhone, CompanyFax, CompanyWebSite,
  404. ContactName, ContactOccupation, ContactAddress1, ContactAddress2, ContactCity, ContactState, ContactZip,
  405. ContactPhone, ContactEMail)
  406. VALUES
  407. (@CompanyName, @CompanyAddress1, @CompanyAddress2, @CompanyCity, @CompanyState, @CompanyZip,
  408. @CompanyMainPhone, @CompanySupportPhone, @CompanyFax, @CompanyWebSite,
  409. @ContactName, @ContactOccupation, @ContactAddress1, @ContactAddress2, @ContactCity, @ContactState, @ContactZip,
  410. @ContactPhone, @ContactEMail)
  411. GO
  412. SET QUOTED_IDENTIFIER OFF
  413. GO
  414. SET ANSI_NULLS ON
  415. GO
  416. SET QUOTED_IDENTIFIER ON
  417. GO
  418. SET ANSI_NULLS OFF
  419. GO
  420. CREATE PROCEDURE [dbo].[SetIndexBucket]
  421. AS
  422. IF not EXISTS (SELECT name FROM sysindexes
  423. WHERE name = 'BUCKET_INDEX')
  424. begin
  425. CREATE INDEX BUCKET_INDEX on SolvedBuckets (Bucket)
  426. end
  427. GO
  428. SET QUOTED_IDENTIFIER OFF
  429. GO
  430. SET ANSI_NULLS ON
  431. GO
  432. SET QUOTED_IDENTIFIER ON
  433. GO
  434. SET ANSI_NULLS OFF
  435. GO
  436. CREATE PROCEDURE [dbo].[SetIndexStopCode]
  437. AS
  438. IF not EXISTS (SELECT name FROM sysindexes
  439. WHERE name = 'STOPCODE_INDEX')
  440. begin
  441. CREATE INDEX STOPCODE_INDEX on HelpInfo (iStopCode)
  442. end
  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 SetModule (
  453. @ModuleID int,
  454. @ModuleName nvarchar(128)
  455. ) AS
  456. IF EXISTS (SELECT * FROM Modules WHERE ModuleID = @ModuleID)
  457. UPDATE Modules SET
  458. ModuleName = @ModuleName
  459. WHERE
  460. ModuleID = @ModuleID
  461. ELSE
  462. INSERT INTO Modules
  463. (ModuleName)
  464. VALUES
  465. (@ModuleName)
  466. GO
  467. SET QUOTED_IDENTIFIER OFF
  468. GO
  469. SET ANSI_NULLS ON
  470. GO
  471. SET QUOTED_IDENTIFIER OFF
  472. GO
  473. SET ANSI_NULLS ON
  474. GO
  475. CREATE PROCEDURE SetPreApprovedCrashSolution (
  476. @SolutionID int,
  477. @ClassID int
  478. ) AS
  479. IF EXISTS ( select * from PreApprovedSolutionClassIDs where ClassID = @ClassID )
  480. UPDATE PreApprovedSolutionClassIDs SET SolutionID = @SolutionID WHERE ClassID = @ClassID
  481. ELSE
  482. INSERT INTO PreApprovedSolutionClassIDs ( SolutionID, ClassID ) VALUES ( @SolutionID, @ClassID )
  483. UPDATE PreApprovedSolutions SET Approved =' 0', ApprovedBy='', LiveSolutionID='' WHERE SolutionID = @SolutionID
  484. GO
  485. SET QUOTED_IDENTIFIER OFF
  486. GO
  487. SET ANSI_NULLS ON
  488. GO
  489. SET QUOTED_IDENTIFIER OFF
  490. GO
  491. SET ANSI_NULLS ON
  492. GO
  493. CREATE PROCEDURE SetPreApprovedLIveSolutionID(
  494. @tmpSolutionID int,
  495. @liveSolutionID int )
  496. AS
  497. UPDATE PreApprovedSolutions SET liveSolutionID = @liveSolutionID WHERE solutionID = @tmpSolutionID
  498. GO
  499. SET QUOTED_IDENTIFIER OFF
  500. GO
  501. SET ANSI_NULLS ON
  502. GO
  503. SET QUOTED_IDENTIFIER OFF
  504. GO
  505. SET ANSI_NULLS ON
  506. GO
  507. CREATE PROCEDURE SetProduct (
  508. @ProductID int,
  509. @ProductName nvarchar(128)
  510. ) AS
  511. IF EXISTS (SELECT * FROM Products WHERE ProductID = @ProductID)
  512. UPDATE Products SET
  513. ProductName = @ProductName
  514. WHERE
  515. ProductID = @ProductID
  516. ELSE
  517. INSERT INTO Products
  518. (ProductName)
  519. VALUES
  520. (@ProductName)
  521. GO
  522. SET QUOTED_IDENTIFIER OFF
  523. GO
  524. SET ANSI_NULLS ON
  525. GO
  526. SET QUOTED_IDENTIFIER OFF
  527. GO
  528. SET ANSI_NULLS ON
  529. GO
  530. CREATE PROCEDURE SetSolution(
  531. @SolutionID int,
  532. @Lang nvarchar(4),
  533. @SolutionType tinyint,
  534. @SP tinyint,
  535. @TemplateID int,
  536. @ProductID int,
  537. @Description nvarchar(1024),
  538. @ContactID int,
  539. @ModuleID int,
  540. @BugID int
  541. ) AS
  542. IF EXISTS (SELECT * FROM KaKnownIssue.dbo.SolutionEx WHERE SolutionID = @SolutionID AND Lang = @Lang)
  543. UPDATE KaKnownIssue.dbo.SolutionEx SET
  544. SolutionType = @SolutionType,
  545. SP = @SP,
  546. TemplateID = @TemplateID,
  547. ProductID = @ProductID,
  548. Description = @Description,
  549. ContactID = @ContactID,
  550. ModuleID = @ModuleID,
  551. BugID = @BugID
  552. WHERE
  553. SolutionID = @SolutionID AND
  554. Lang = @Lang
  555. ELSE
  556. INSERT INTO KaKnownIssue.dbo.SolutionEx
  557. (SolutionID, Lang, SolutionType, SP, TemplateID, ProductID, Description, ContactID, ModuleID, BugID)
  558. VALUES
  559. (@SolutionID, @Lang, @SolutionType, @SP, @TemplateID, @ProductID, @Description, @ContactID, @ModuleID, @BugID)
  560. SELECT Solution = @@IDENTITY
  561. GO
  562. SET QUOTED_IDENTIFIER OFF
  563. GO
  564. SET ANSI_NULLS ON
  565. GO
  566. SET QUOTED_IDENTIFIER OFF
  567. GO
  568. SET ANSI_NULLS ON
  569. GO
  570. CREATE PROCEDURE SetTemplate (
  571. @TemplateID int,
  572. @TemplateName nvarchar(32),
  573. @Description ntext
  574. ) AS
  575. IF EXISTS (SELECT * FROM Templates WHERE TemplateID = @TemplateID)
  576. UPDATE Templates SET
  577. TemplateName = @TemplateName,
  578. Description = @Description
  579. WHERE
  580. TemplateID = @TemplateID
  581. ELSE
  582. INSERT INTO Templates
  583. (TemplateName, Description)
  584. VALUES
  585. (@TemplateName, @Description)
  586. GO
  587. SET QUOTED_IDENTIFIER OFF
  588. GO
  589. SET ANSI_NULLS ON
  590. GO